From ff2425706206c47fb25bcbab94014070555e6dad Mon Sep 17 00:00:00 2001 From: Jan Grasnick Date: Wed, 26 Oct 2016 09:36:04 +0200 Subject: [PATCH] Add support for datetime_field to fields.Reference issue4579 review27721002 --- CHANGELOG | 1 + tryton/gui/window/view_form/model/field.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index f27f243f30..f54a44098f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add support for datetime_field to Reference * Show non editable widget as insensitive * Move info-bar at the bottom * Manage readonly on fields translation dialog diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 6a94ae1822..ebb8137507 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -837,6 +837,13 @@ class ReferenceField(Field): record.value[self.name] = ref_model, ref_id record.value[self.name + '.rec_name'] = rec_name + def context_get(self, record): + context = super(ReferenceField, self).context_get(record) + if self.attrs.get('datetime_field'): + context['_datetime'] = record.get_eval( + )[self.attrs.get('datetime_field')] + return context + def get_on_change_value(self, record): if record.parent_name == self.name and record.parent: return record.parent.model_name, record.parent.get_on_change_value(