From cb313d25572cb8b22c808039b75afb8798e7736d 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 --- 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 8f605d4f34..97d14f27ef 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -783,6 +783,12 @@ class ReferenceField(CharField): return None def get(self, record): + 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):