From 05abf8ef2bb18266f8ec8a0bbed241e5163cf536 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 --- 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 0a06498c3d..e7d172a901 100644 --- a/sao/src/model.js +++ b/sao/src/model.js @@ -2557,8 +2557,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 06247c5f08..be32f31b1d 100644 --- a/tryton/tryton/gui/window/view_form/model/field.py +++ b/tryton/tryton/gui/window/view_form/model/field.py @@ -621,12 +621,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