base/res/partner/partner.py: unconditional use of partner_id in name_get()

Bug #503445 reported by Adam James
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

name_get() in partner.py assumes that a res.partner.address will always contain a partner_id. However the field is not set as required and the ondelete method is 'set null'. So it's quite possible for partner_id to be NULL.

I encountered this error when trying to access the Internal Moves tree in Stock Management:

File "/usr/lib/openerp-server/osv/osv.py", line 59, in wrapper
     return f(self, dbname, *args, **kwargs)
File "/usr/lib/openerp-server/osv/osv.py", line 118, in execute
     res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/openerp-server/osv/osv.py", line 110, in execute_cr
   return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/lib/openerp-server/osv/orm.py", line 2077, in read
    result = self._read_flat(cr, user, select, fields, context, load)
File "/usr/lib/openerp-server/osv/orm.py", line 2188, in _read_flat
    res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res)
File "/usr/lib/openerp-server/osv/fields.py", line 310, in get
     names = dict(obj.name_get(cr, user, filter(None, res.values()), context))
File "/usr/lib/openerp-server/addons/base/res/partner/partner.py", line 311, in name_get
     res.append((r['id'], r['partner_id'][1]))
TypeError: 'bool' object is unsubscriptable

r['partner_id'] is False at this point.

Related branches

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Its already fixed in trunk.
Fixed by revision 1921 <email address hidden> for stable.

Thank you.

Changed in openobject-server:
status: New → Confirmed
status: Confirmed → 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.