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
This commit is contained in:
Nicolas Évrard
2024-12-16 10:29:26 +01:00
parent 8231c86885
commit 1caecadfc0
2 changed files with 1 additions and 4 deletions
+1 -2
View File
@@ -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;
@@ -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