From 1caecadfc0e06300a483ee6c72c6d926663aade8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Mon, 16 Dec 2024 10:29:26 +0100 Subject: [PATCH] Do not set the Group's context when setting a default group on xxx2Many The context of the field is dynamic so evaluating it only once when creating the group make it static. Also the group is already evaluating the parent field context on the fly when its context is retrieved. Closes #13726 (grafted from b21813a75b5beeb625b1e9533cbc498b7872555f) --HG-- branch : 7.0 --- sao/src/model.js | 3 +-- tryton/tryton/gui/window/view_form/model/field.py | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/sao/src/model.js b/sao/src/model.js index 81dd2b1298..653b15cec0 100644 --- a/sao/src/model.js +++ b/sao/src/model.js @@ -2526,8 +2526,7 @@ if (record.model.name == this.description.relation) { model = record.model; } - var context = record.expr_eval(this.description.context || {}); - var group = Sao.Group(model, context, []); + var group = Sao.Group(model, {}, []); group.set_parent(record); group.parent_name = this.description.relation_field; group.child_name = this.name; diff --git a/tryton/tryton/gui/window/view_form/model/field.py b/tryton/tryton/gui/window/view_form/model/field.py index 2561aa5231..e4756e3813 100644 --- a/tryton/tryton/gui/window/view_form/model/field.py +++ b/tryton/tryton/gui/window/view_form/model/field.py @@ -619,12 +619,10 @@ class O2MField(Field): from .group import Group parent_name = self.attrs.get('relation_field', '') fields = fields or {} - context = record.expr_eval(self.attrs.get('context', {})) group = Group(self.attrs['relation'], fields, parent=record, parent_name=parent_name, child_name=self.name, - context=context, parent_datetime_field=self.attrs.get('datetime_field')) if not fields and record.model_name == self.attrs['relation']: group.fields = record.group.fields