[MERGE] opw 50831
authorolt@tinyerp.com <>
Fri, 27 Jan 2012 08:48:07 +0000 (09:48 +0100)
committerolt@tinyerp.com <>
Fri, 27 Jan 2012 08:48:07 +0000 (09:48 +0100)
bzr revid: olt@tinyerp.com-20120127084807-br1qcn5lyhbn5vqn

bin/osv/fields.py

index fb37ae4..09bd5f5 100644 (file)
@@ -149,9 +149,21 @@ class integer_big(_column):
 
 class reference(_column):
     _type = 'reference'
+    _classic_read = False 
     def __init__(self, string, selection, size, **args):
         _column.__init__(self, string=string, size=size, selection=selection, **args)
 
+    def get(self, cr, obj, ids, name, uid=None, context=None, values=None):
+        result = {}
+        # copy initial values fetched previously.
+        for value in values:
+            result[value['id']] = value[name]
+            if value[name]:
+                model, res_id = value[name].split(',')
+                if not obj.pool.get(model).exists(cr, uid, [int(res_id)], context=context):
+                    result[value['id']] = False
+        return result
+
 
 class char(_column):
     _type = 'char'