passing ids as integer to account.account write method throws KeyError: "Field '0' does not exist in object 'browse_record'...
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Fix Released
|
Low
|
OpenERP R&D Addons Team 3 |
Bug Description
If "ids" is passed to write as integer instead of a list you get this:
Traceback (most recent call last):
File "/home/
return f(self, dbname, *args, **kwargs)
File "/home/
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/
self.
File "/home/
for account in self.browse(cr, uid, ids, context=context):
File "/home/
name, self))
KeyError: "Field '0' does not exist in object 'browse_
as you can see the error occurs into _check_
for account in self.browse(cr, uid, ids, context=context):
the problem can be easily solved using:
if not isinstance(
ids = [ids,]
for account in self.browse(cr, uid, ids, context=context):
The weird thing is that also at line 544 [2] we have:
if 'company_id' in vals:
if move_lines:
# Allow the write if the value is the same
for i in [i['company_id'][0] for i in self.read(
beside the horrible nested for.... this *is going to fail* whenever ids is not a list.
I supposed you've been lucky till here because probably when 'company_id' is in vals you have always a list...
This bug is similar to https:/
[1] http://
[2] http://
Related branches
- Mustufa Rangwala (Open ERP) (community): Approve
- qdp (OpenERP): Pending requested
-
Diff: 17 lines (+5/-0)1 file modifiedaccount/account.py (+5/-0)
Changed in openobject-addons: | |
assignee: | nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3) |
importance: | Undecided → Low |
status: | New → Confirmed |
Changed in openobject-addons: | |
status: | Confirmed → In Progress |
Changed in openobject-addons: | |
milestone: | none → 6.1 |
Hello Simone Orsi,
Thanks for Reporting and contribution, Following are the Revision ID and Number of the bug :
Revision ID : <email address hidden>
Revision Number : 4890
The solution will be merged in addons soon.
Thanks & Regards,
Devnani Bharat R.