From 736c0a327d663910f376acb7d6a543d649a84b4f Mon Sep 17 00:00:00 2001 From: thibault Date: Tue, 3 Oct 2023 18:23:13 +0200 Subject: [PATCH] [FIX] web_remember_tree_column_width : Column resizing with list_button column Fix an error when retrieving column sizes for lists containing one or more list_button columns. This error occurs when a list_button column is placed between other columns in the list. This type of column is excluded from the querySelector string used to retrieve column headers, which can cause the index to shift and the column size to change when the list is displayed. --- .../static/src/js/list_renderer.esm.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web_remember_tree_column_width/static/src/js/list_renderer.esm.js b/web_remember_tree_column_width/static/src/js/list_renderer.esm.js index eef04db1d..bf8c4a3c0 100644 --- a/web_remember_tree_column_width/static/src/js/list_renderer.esm.js +++ b/web_remember_tree_column_width/static/src/js/list_renderer.esm.js @@ -11,10 +11,15 @@ patch(ListRenderer.prototype, "web_remember_tree_column_width.ListRenderer", { computeColumnWidthsFromContent() { const columnWidths = this._super.apply(this, arguments); const table = this.tableRef.el; - const thElements = [...table.querySelectorAll("thead th:not(.o_list_button)")]; + const thElements = [...table.querySelectorAll("thead th")]; thElements.forEach((el, elIndex) => { const fieldName = $(el).data("name"); - if (this.props.list.resModel && fieldName && browser.localStorage) { + if ( + !el.classList.contains("o_list_button") && + this.props.list.resModel && + fieldName && + browser.localStorage + ) { const storedWidth = browser.localStorage.getItem( `odoo.columnWidth.${this.props.list.resModel}.${fieldName}` );