Review: Needs Fixing

The fix is not correct:

1. There is a 'special' flag on periods that is meant to indicate 
opening/closing periods, so we should use it instead of depending on start == 
stop to find them. There could be valid cases where normal periods need to have 
start == stop, depending on customer needs.
One problem remains: all demo periods have the 'special' flag (to allow 
creating overlapping fiscal years), so filtering all 'special' periods would 
result in not finding any period in demo mode. To solve this we can implement a 
2-step filter: we search for a matching period that is not 'special' and if we 
don't find any, we return all matching periods. This behavior makes sense in 
all cases.

2. The period.find() method performs a search() to find suitable periods, so 
why iterate on the results to filter them instead of using directly the right 
search criterion? 

3. period.find() is a dangerous method to modify, because it is used by many 
other sensitive places in the accounting code. Changing the return values in 
all cases is very risky, so instead we can turn on the new behavior via a 
context flag, to minimize risks and also minimize API changes (no new 
parameter).

I'll fix the above before merging.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-576006-rha/+merge/111182
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-576006-rha.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to