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
This commit is contained in:
+1
-2
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user