Review: Needs Fixing

Amit Bhavsar(OpenERP),

Tactically, you should not pass context=None especially when the period name 
going to be fetched via browse. (The reason being the name is string).

Additionally, passing [] for browse and fetching [0] doesn't sound fruitful.

You could have solved by:
1. period_pool.browse(cr, uid, period_id, context=context).name
Or
2. period_pool.read(cr, uid, [period_id], ['name'])[0]['name']

Both the ways are advisable. Looking at the other lines (94), this seems copied 
for read().

Moreover, if you look closely, there is a quite fair chance of getting variable 
'period_string' undefined error (when period_id is False).

In a closer look, you don't need 'if period_id'  because this will never be 
False. It will either be True or will be blocked by a exception!

Hope this helps shedding more focus on the fix.

Thanks,
Serpent Consulting Services.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1026434-amb/+merge/115664
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1026434-amb.

_______________________________________________
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