From 3cddb6989ba119962be444cd8b8859d047174f6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 7 Aug 2008 17:40:59 +0200 Subject: [PATCH] Improve reference field for missing record and missing object --- trytond/osv/fields.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/trytond/osv/fields.py b/trytond/osv/fields.py index 3831f75e5b..bb69913c1c 100644 --- a/trytond/osv/fields.py +++ b/trytond/osv/fields.py @@ -134,6 +134,8 @@ class Reference(Column): if not res[i]: continue ref_model, ref_id = res[i].split(',', 1) + if not ref_model: + continue ref_obj = obj.pool.get(ref_model) if not ref_obj: continue @@ -141,6 +143,11 @@ class Reference(Column): ref_id = eval(ref_id) except: pass + if ref_id \ + and not ref_obj.search(cursor, user, [ + ('id', '=', ref_id), + ], context=context): + ref_id = False if ref_id: ref_name = ref_obj.name_get(cursor, user, ref_id, context=context)