Might be better to send id to as a list rather than an integer ...write(cr, uid,.....

Bug #1247087 reported by Salton Massally
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Human Resources - Next Generation for OpenERP
Invalid
Undecided
Unassigned

Bug Description

Many code, even some parts of core, assume that id sent to .write(cr, uid, ids.... methods are lists. There are many areas were its sent to ...browse(cr... without even being checked if list or integer and since the later method returns a list or a single object depending if ids passed in is a list or int, this causes trouble with loops... I am thinking that it might be better to send id to ...write(... as a list rather than a int e.g

line 109 .../addons/hr_job_hierarchy/hr.py is ee_obj.write(cr, uid, ee.id, {'parent_id': parent_id}, context=context) maybe can be
ee_obj.write(cr, uid, [ee.id,], {'parent_id': parent_id}, context=context) to avoid potential problems....

Revision history for this message
Michael Telahun Makonnen (mmakonnen) wrote :

Generally, the OpenERP core is good at not blowing up in this kind of situations. Most such problems are encountered in third party addons. These should be report as they are encountered and fixed in the offending code. Also, unless you process the result from these functions (read, write, create, unlink, etc) you should just pass on the arguments without modifying them. In this specific case passing single values in the ids field is common practice because the underlying functions will do the right thing whether it's a single value or a list. If you have any examples of code that is causing actual problems, I would be happy to look at them. But, otherwise, I am marking this bug as invalid.

Thanks.

Changed in addons-hr-ng:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.