From 4bacba8f75226c96d0437652f9b35ce2c081dee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 9 Jan 2014 18:45:14 +0100 Subject: [PATCH] Force value of parent Reference field Since 2.6, reference field can be used in One2Many so in this case the value should be forced like for Many2One. review2581002 (transplanted from 67acb340ba7caf7f6c801e2c7af6884e6603b614) --- tryton/gui/window/view_form/model/field.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index fad9d67454..7b5b764805 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -816,6 +816,12 @@ class ReferenceField(CharField): return None def get(self, record, check_load=True, readonly=True, modified=False): + if record.parent_name == self.name: + if record.parent: + return '%s,%s' % (record.group.parent.model_name, + record.parent.id) + else: + return None if (record.value.get(self.name) and record.value[self.name][0] and record.value[self.name][1] >= -1):