From 570d35e8244f588b4ead88ed573e8cf73b073c8b Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Sat, 15 Jan 2011 00:05:24 +0100 Subject: [PATCH] [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 --- bin/osv/fields.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index ee87fe6a1ce..72df0e925ad 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -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)