From e92d79df01a9bd4c77c5979e9e114f3fabba97f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 15 Oct 2024 12:13:54 +0200 Subject: [PATCH] Group optional column with the same The optional state is stored only by field name so the toggle menu should display only one state per column name to avoid ambiguity. Closes #13603 --- sao/src/view/tree.js | 33 +++++++++++-------- .../tryton/gui/window/view_form/view/list.py | 25 +++++++++----- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/sao/src/view/tree.js b/sao/src/view/tree.js index eb8def9819..c7006e962d 100644 --- a/sao/src/view/tree.js +++ b/sao/src/view/tree.js @@ -72,7 +72,8 @@ this.view.columns.push(column); if (attributes.optional) { - this.view.optionals.push(column); + Sao.setdefault( + this.view.optionals, column.attributes.name, []).push(column); } if (parseInt(attributes.sum || '0', 10)) { @@ -99,7 +100,7 @@ display_size: Sao.config.display_size, init: function(view_id, screen, xml, children_field) { this.children_field = children_field; - this.optionals = []; + this.optionals = {}; this.sum_widgets = new Map(); this.columns = []; this.selection_mode = (screen.attributes.selection_mode || @@ -254,7 +255,7 @@ this.set_drag_and_drop(); th = this.thead.find('th').first(); - if (this.optionals.length) { + if (!jQuery.isEmptyObject(this.optionals)) { th.addClass('optional'); } var menu = jQuery('