From ea41b524494fa914342591ea81fac430c4105b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 15 Oct 2024 12:25:46 +0200 Subject: [PATCH] Apply saved optional to column with the optional attribute If the same column is added twice in a view with and without optional, only the columns with optional attribute must be updated. --- sao/src/view/tree.js | 5 +++-- tryton/tryton/gui/window/view_form/view/list.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sao/src/view/tree.js b/sao/src/view/tree.js index c7006e962d..d2a6d77e63 100644 --- a/sao/src/view/tree.js +++ b/sao/src/view/tree.js @@ -826,8 +826,9 @@ return; } var optional; - if (Object.prototype.hasOwnProperty.call( - tree_column_optional, name)) { + if ((column.attributes.optional) && + Object.prototype.hasOwnProperty.call( + tree_column_optional, name)) { optional = tree_column_optional[name]; } else { optional = Boolean(parseInt( diff --git a/tryton/tryton/gui/window/view_form/view/list.py b/tryton/tryton/gui/window/view_form/view/list.py index 6d51fb818f..fabd289465 100644 --- a/tryton/tryton/gui/window/view_form/view/list.py +++ b/tryton/tryton/gui/window/view_form/view/list.py @@ -1166,7 +1166,8 @@ class ViewTree(View): continue widget = self.get_column_widget(column) widget.set_editable() - if column.name in tree_column_optional: + if ('optional' in widget.attrs + and column.name in tree_column_optional): optional = tree_column_optional[column.name] else: optional = bool(int(widget.attrs.get('optional', '0')))