From 296532218f2215c3f951889ea1d44b28594daa54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 30 Apr 2025 08:44:05 +0200 Subject: [PATCH] Declare vals_to_set on the common block where it is used e38f22986aac reuse vals_to_set later so linter may complain about it not being defined. --- sao/src/model.js | 10 +++++++--- tryton/tryton/gui/window/view_form/model/field.py | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sao/src/model.js b/sao/src/model.js index 2c8e32ae53..c345788189 100644 --- a/sao/src/model.js +++ b/sao/src/model.js @@ -2514,6 +2514,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) { @@ -2523,9 +2524,9 @@ } const 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]; } } @@ -2561,7 +2562,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 51fd9ef330..0312a2c865 100644 --- a/tryton/tryton/gui/window/view_form/model/field.py +++ b/tryton/tryton/gui/window/view_form/model/field.py @@ -861,6 +861,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', []):