[FIX] fields.property: restore compatibility with non-m2o properties
authorOlivier Dony <odo@openerp.com>
Fri, 14 Jan 2011 23:05:24 +0000 (00:05 +0100)
committerOlivier Dony <odo@openerp.com>
Fri, 14 Jan 2011 23:05:24 +0000 (00:05 +0100)
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

index ee87fe6..72df0e9 100644 (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)