[FIX] fields.sparse: fix multiple relational sparse fields on same model, courtesy of Guewen Baconnier (Camptocamp)

lp bug: https://launchpad.net/bugs/912203 fixed

bzr revid: odo@openerp.com-20120214125725-p2ayh1lckr50vebi
This commit is contained in:
Olivier Dony
2012-02-14 13:57:25 +01:00
+2 -2
View File
@@ -1315,10 +1315,10 @@ class sparse(function):
value = value or []
if value:
# filter out deleted records as superuser
relation_obj = obj.pool.get(self.relation)
relation_obj = obj.pool.get(obj._columns[field_name].relation)
value = relation_obj.exists(cr, openerp.SUPERUSER_ID, value)
if type(value) in (int,long) and field_type == 'many2one':
relation_obj = obj.pool.get(self.relation)
relation_obj = obj.pool.get(obj._columns[field_name].relation)
# check for deleted record as superuser
if not relation_obj.exists(cr, openerp.SUPERUSER_ID, [value]):
value = False