diff --git a/sao/src/model.js b/sao/src/model.js index c55a036949..5b8396b567 100644 --- a/sao/src/model.js +++ b/sao/src/model.js @@ -2906,12 +2906,11 @@ Sao.field.Dict._super.set.call(this, record, value); }, get: function(record) { - return (Sao.field.Dict._super.get.call(this, record) || - this._default); + return jQuery.extend( + {}, Sao.field.Dict._super.get.call(this, record)); }, get_client: function(record) { - return (Sao.field.Dict._super.get_client.call(this, record) || - this._default); + return Sao.field.Dict._super.get_client.call(this, record); }, validation_domains: function(record, pre_validate) { return this.get_domains(record, pre_validate)[0]; diff --git a/sao/src/view/form.js b/sao/src/view/form.js index 95c55158b1..3189cc9baa 100644 --- a/sao/src/view/form.js +++ b/sao/src/view/form.js @@ -5056,6 +5056,7 @@ function eval_pyson(value){ for (const key of new_names) { value[key] = null; } + this.field.set_client(this.record, value); this._display().then(() => { this.fields[new_names[0]].input.focus(); }); diff --git a/tryton/tryton/gui/window/view_form/model/field.py b/tryton/tryton/gui/window/view_form/model/field.py index 5f7cd64310..479b668b04 100644 --- a/tryton/tryton/gui/window/view_form/model/field.py +++ b/tryton/tryton/gui/window/view_form/model/field.py @@ -1178,10 +1178,10 @@ class DictField(Field): self.keys = {} def get(self, record): - return super(DictField, self).get(record) or self._default + return (super().get(record) or self._default).copy() def get_client(self, record): - return super(DictField, self).get_client(record) or self._default + return super().get_client(record) def validation_domains(self, record, pre_validate=None): screen_domain, attr_domain = self.domains_get(record, pre_validate) diff --git a/tryton/tryton/gui/window/view_form/view/form_gtk/dictionary.py b/tryton/tryton/gui/window/view_form/view/form_gtk/dictionary.py index d1750633e1..b500012621 100644 --- a/tryton/tryton/gui/window/view_form/view/form_gtk/dictionary.py +++ b/tryton/tryton/gui/window/view_form/view/form_gtk/dictionary.py @@ -513,6 +513,7 @@ class DictWidget(Widget): self.send_modified() value = self.field.get_client(self.record) value.update({k: None for k in new_keys}) + self.field.set_client(self.record, value) self.display() # Use idle add because it can be called from the callback