[FIX] Sparse field: get relation of the correct field

bzr revid: guewen.baconnier@camptocamp.com-20120105104051-7jn2n5kd92nexa31
This commit is contained in:
Guewen Baconnier
2012-01-05 11:40:51 +01:00
parent f08a8d253e
commit 8b8a0234f0
+2 -2
View File
@@ -1274,10 +1274,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