[FIX] fields.property: restore compatibility with non-m2o properties

Was broken by revision 3029.2.20  ysa@tinyerp.com-20101231061314-jhjc6c2uyeqko19x, fixing bug 692891

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

bzr revid: odo@openerp.com-20110114230524-zkkvgi6ch7gk3d4m
This commit is contained in:
Olivier Dony 2011-01-15 00:05:24 +01:00
parent 04d2a25816
commit 570d35e824
1 changed files with 7 additions and 4 deletions

View File

@ -1057,11 +1057,14 @@ class property(function):
brs = properties.browse(cr, uid, nids, context=context)
for prop in brs:
value = properties.get_by_record(cr, uid, prop, context=context)
record_exists = obj.pool.get(value._name).exists(cr, uid, value.id)
res[prop.res_id.id][prop.fields_id.name] = (record_exists and value) and value or False
res[prop.res_id.id][prop.fields_id.name] = value or False
if value and (prop.type == 'many2one'):
replaces.setdefault(value._name, {})
replaces[value._name][value.id] = True
record_exists = obj.pool.get(value._name).exists(cr, uid, value.id)
if record_exists:
replaces.setdefault(value._name, {})
replaces[value._name][value.id] = True
else:
res[prop.res_id.id][prop.fields_id.name] = False
for rep in replaces:
nids = obj.pool.get(rep).search(cr, uid, [('id','in',replaces[rep].keys())], context=context)