[6.1] account_bank - post_write method not single id safe

Bug #888135 reported by Yannick Vaucher @ Camptocamp
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Addons Team 3

Bug Description

Hello,

While using some ooor script, I figured out that the method write crash if you try to use a single id instead of a list of ids.

Traceback (most recent call last):
  File "/home/yvaucher/Projects/dnag_openerp_6_1/test/src/server/openerp/wsgi.py", line 77, in xmlrpc_return
    result = openerp.netsvc.dispatch_rpc(service, method, params)
  File "/home/yvaucher/Projects/dnag_openerp_6_1/test/src/server/openerp/netsvc.py", line 325, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/yvaucher/Projects/dnag_openerp_6_1/test/src/server/openerp/service/web_services.py", line 580, in dispatch
    res = fn(db, uid, *params)
  File "/home/yvaucher/Projects/dnag_openerp_6_1/test/src/server/openerp/osv/osv.py", line 120, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/yvaucher/Projects/dnag_openerp_6_1/test/src/server/openerp/osv/osv.py", line 172, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/yvaucher/Projects/dnag_openerp_6_1/test/src/server/openerp/osv/osv.py", line 163, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/yvaucher/Projects/dnag_openerp_6_1/test/src/server/openerp/addons/account/account_bank.py", line 38, in write
    return result
  File "/home/yvaucher/Projects/dnag_openerp_6_1/test/src/server/openerp/addons/account/account_bank.py", line 44, in post_write
    if bank.company_id and not bank.journal_id:
  File "/home/yvaucher/Projects/dnag_openerp_6_1/test/src/server/openerp/osv/orm.py", line 490, in __iter__
    raise NotImplementedError("Iteration is not allowed on %s" % self)
NotImplementedError: Iteration is not allowed on browse_record(res.partner.bank, 17)

This issue come from method post_write that is expecting a list of ids.

A patch is attached.

Regards,
Yannick

Related branches

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :
Amit Parik (amit-parik)
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
Revision history for this message
Bharat Devnani (Open ERP) (bde-openerp) wrote :

Hello Yannick Vaucher,

Thanks for reporting and for your contribution, the solution of this bug is proposed in branch
lp:~openerp-dev/openobject-addons/trunk-bug-888135-bde with following Revision ID and Number :

Revision ID : <email address hidden>
Revision Number : 5686

The solution will be merged with main addons soon.

Thanks & Regards,
Devnani Bharat R.

Changed in openobject-addons:
status: In Progress → Fix Committed
Revision history for this message
Vo Minh Thu (thu) wrote :

Thanks for the patch! It has landed in trunk:
revno: 5688
revision-id: <email address hidden>

Changed in openobject-addons:
status: Fix Committed → Fix Released
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.