← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 740202] [NEW] passing int to write method of stock.move gives "Field '0' does not exist in object 'browse_record(stock.move, ..."

 

Public bug reported:

- Call the write method of stock.move passing ids as INT (instead of LIST) with user != admin
- Get
  File "server/bin/addons/stock/stock.py", line 1616, in write
    for move in self.browse(cr, uid, ids, context=context):
  File "server/bin/osv/orm.py", line 189, in __getitem__
    name, self))
KeyError: "Field '0' does not exist in object 'browse_record(stock.move, 422)'"

Suggested FIX:
After line 1614 ( http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/4567/stock/stock.py#L1611 ) add

            if isinstance(ids, (int, long)):
                ids = [ids]

** Affects: openobject-addons
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/740202

Title:
  passing int to write method of stock.move gives "Field '0' does not
  exist in object 'browse_record(stock.move,..."

Status in OpenERP Modules (addons):
  New

Bug description:
  - Call the write method of stock.move passing ids as INT (instead of LIST) with user != admin
  - Get
    File "server/bin/addons/stock/stock.py", line 1616, in write
      for move in self.browse(cr, uid, ids, context=context):
    File "server/bin/osv/orm.py", line 189, in __getitem__
      name, self))
  KeyError: "Field '0' does not exist in object 'browse_record(stock.move, 422)'"

  Suggested FIX:
  After line 1614 ( http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/4567/stock/stock.py#L1611 ) add

              if isinstance(ids, (int, long)):
                  ids = [ids]



Follow ups

References