diff --git a/sao/src/model.js b/sao/src/model.js index c8e7546fd2..d9f3a09b6f 100644 --- a/sao/src/model.js +++ b/sao/src/model.js @@ -2379,6 +2379,7 @@ } if (value && (value.add || value.update)) { + let vals_to_set = {}; // First set already added fields to prevent triggering a // second on_change call if (value.update) { @@ -2388,9 +2389,9 @@ } var record2 = group.get(vals.id); if (record2) { - var vals_to_set = {}; for (var key in vals) { - if (!Object.prototype.hasOwnProperty.call(new_field_names, key)) { + if (!Object.prototype.hasOwnProperty.call( + new_field_names, key)) { vals_to_set[key] = vals[key]; } } @@ -2426,7 +2427,10 @@ if (record2) { let to_update = Object.fromEntries( Object.entries(vals).filter( - ([k, v]) => !Object.prototype.hasOwnProperty.call(vals_to_set, k) + ([k, v]) => { + !Object.prototype.hasOwnProperty.call( + vals_to_set, k) + } )); record2.set_on_change(to_update); } diff --git a/tryton/tryton/gui/window/view_form/model/field.py b/tryton/tryton/gui/window/view_form/model/field.py index a434bd1cd1..8fab0561d3 100644 --- a/tryton/tryton/gui/window/view_form/model/field.py +++ b/tryton/tryton/gui/window/view_form/model/field.py @@ -798,6 +798,7 @@ class O2MField(Field): force_remove=False) if value and (value.get('add') or value.get('update', [])): + vals_to_set = {} # First set already added fields to prevent triggering a # second on_change call for vals in value.get('update', []):