Internal RPC method requests like 'read' should send a list of IDs

Bug #1064087 reported by Sébastien Alix
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OERPLib
Fix Released
Medium
Unassigned

Bug Description

This following request crashes on OpenERP server 6.0.3:

>>> oerp.read('res.currency', 1)

OpenERP traceback:

Traceback (most recent call last):
  File "/home/oerp/openerp-server-6.0.3/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/oerp/openerp-server-6.0.3/bin/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/oerp/openerp-server-6.0.3/bin/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/oerp/openerp-server-6.0.3/bin/addons/base/res/res_currency.py", line 75, in read
    rates=r['rate_ids']
TypeError: string indices must be integers, not str

To fix that, a list of IDs must be sent:

>>> oerp.read('res.currency', [1])
[{'rate_ids': [1], 'name': 'EUR', 'rounding': 0.01, 'symbol': u'\u20ac', 'company_id': [1, 'OpenERP S.A.'], 'date': '2012-01-01', 'rate': 1.0, 'base': False, 'active': True, 'id': 1, 'accuracy': 4}]

'read' method is used by the browse functionality, but has to be used with a list of IDs to avoid any problems.

Changed in oerplib:
milestone: none → 0.6.1
status: New → Fix Committed
Changed in oerplib:
milestone: 0.6.1 → 0.7
Changed in oerplib:
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.