Skip to content
Snippets Groups Projects
Commit 478854aa authored by Vo Minh Thu's avatar Vo Minh Thu
Browse files

[FIX] fields.reference: post-process reference fields to test if the referenced record exists.

bzr revid: vmt@openerp.com-20111005113434-itjuj0u3d6fhryn8
parents 5eeeb67e 7ccc7f38
No related branches found
No related tags found
No related merge requests found
......@@ -156,9 +156,22 @@ class integer_big(_column):
class reference(_column):
_type = 'reference'
_classic_read = False # post-process to handle missing target
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:
if value[name]:
model, res_id = value[name].split(',')
if obj.pool.get(model).exists(cr, uid, [int(res_id)], context=context):
result[value['id']] = value[name]
else:
result[value['id']] = False
return result
class char(_column):
_type = 'char'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment