From 4713bd26db5ccea57722e72c62825d364549070a Mon Sep 17 00:00:00 2001 From: sergio-teruel Date: Mon, 2 Nov 2026 07:26:32 +0100 Subject: [PATCH 1/7] [FIX] web_dialog_size: No window resize when maximizing or restoring. Maximizing a dialog, by default or with the maximize/restore button, dispatched a synthetic window resize event. Components that close on window resize then close as well, even when they own the dialog. For example, in the analytic distribution widget, choosing "Search More..." on an analytic account opens the dialog, the resize closes the widget popup and the dialog is destroyed with it, so it disappears immediately (or as soon as it is maximized or restored by hand). The resize was there to make a list with manually resized columns fill the new dialog size: manual resizing fixes the width of the table and its parent in pixels, so the list no longer follows the dialog width. Unset those widths instead when using the buttons, so the list fits its columns through its own resize observer. Maximizing on open needs nothing, as no column has been resized yet. --- .../static/src/js/web_dialog_size.esm.js | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/web_dialog_size/static/src/js/web_dialog_size.esm.js b/web_dialog_size/static/src/js/web_dialog_size.esm.js index e8753bef19cc..c467d99562b4 100644 --- a/web_dialog_size/static/src/js/web_dialog_size.esm.js +++ b/web_dialog_size/static/src/js/web_dialog_size.esm.js @@ -5,10 +5,26 @@ import {SelectCreateDialog} from "@web/views/view_dialogs/select_create_dialog"; import {patch} from "@web/core/utils/patch"; import {useService} from "@web/core/utils/hooks"; -function triggerWindowResize() { - requestAnimationFrame(() => { - window.dispatchEvent(new Event("resize")); - }); +/** + * Resizing a list column by hand fixes the width of the table and its parent in + * pixels, so the list no longer follows the dialog width. Unset them to let the + * list fit its columns to the new dialog size. + * + * A window resize event would do it too, but it also closes every component + * listening to it, such as the analytic distribution widget, and with it the + * "Search More..." dialog it opened. + * + * @param {HTMLElement} el element inside the dialog + */ +function resetListColumnWidths(el) { + const dialog = el.closest(".modal-content"); + if (!dialog) { + return; + } + for (const table of dialog.querySelectorAll(".o_list_table")) { + table.style.width = ""; + table.parentElement.style.width = ""; + } } export class ExpandButton extends Component { @@ -25,7 +41,7 @@ export class ExpandButton extends Component { this.config .then(function (r) { if (r.default_maximize) { - self.dialog_button_extend(); + self.props.setsize("dialog_full_screen"); } }) .catch(() => { @@ -34,14 +50,14 @@ export class ExpandButton extends Component { }); } - dialog_button_extend() { + dialog_button_extend(ev) { + resetListColumnWidths(ev.currentTarget); this.props.setsize("dialog_full_screen"); - triggerWindowResize(); } - dialog_button_restore() { + dialog_button_restore(ev) { + resetListColumnWidths(ev.currentTarget); this.props.setsize(this.last_size); - triggerWindowResize(); } } From c9f9e919c95d80815a006121785cffcd687688a0 Mon Sep 17 00:00:00 2001 From: sergio-teruel Date: Tue, 3 Nov 2026 06:01:33 +0100 Subject: [PATCH 2/7] [FIX] web_dialog_size: Switch the maximize/restore icon. The button only showed the icon matching the dialog size it had when it was first rendered. Its props (the size getter and setter) never change, so rendering the dialog with a new size does not render the button again. With "default maximize" on, the dialog opened maximized with the maximize icon, and clicking it did nothing, so it could not be restored. Keep the size in the button state so it switches icon on each change. --- web_dialog_size/README.rst | 3 ++- web_dialog_size/readme/CONTRIBUTORS.md | 1 + web_dialog_size/static/description/index.html | 3 ++- .../static/src/js/web_dialog_size.esm.js | 16 ++++++++++++---- web_dialog_size/static/src/xml/ExpandButton.xml | 4 ++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/web_dialog_size/README.rst b/web_dialog_size/README.rst index 8e2581e53f20..583bd460362f 100644 --- a/web_dialog_size/README.rst +++ b/web_dialog_size/README.rst @@ -11,7 +11,7 @@ Web Dialog Size !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:a306b45986bf786b971c49a98fb0d1a7af7ca0317b0eee223c5bb7bf8505d836 + !! source digest: sha256:74af38a912a67506f943a841efc785a9614a64ef5dcf8283afa1f3c3200b2817 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -96,6 +96,7 @@ Contributors - Jairo Llopis - Ernesto Tejeda - Carlos Roca + - Sergio Teruel - Sudhir Arya - Pierre Pizzetta diff --git a/web_dialog_size/readme/CONTRIBUTORS.md b/web_dialog_size/readme/CONTRIBUTORS.md index 8b9a9b08cd77..e1d585b8ac31 100644 --- a/web_dialog_size/readme/CONTRIBUTORS.md +++ b/web_dialog_size/readme/CONTRIBUTORS.md @@ -10,6 +10,7 @@ - Jairo Llopis - Ernesto Tejeda - Carlos Roca + - Sergio Teruel - Sudhir Arya \<\> - Pierre Pizzetta \<\> - Mantas Šniukas \<\> diff --git a/web_dialog_size/static/description/index.html b/web_dialog_size/static/description/index.html index de66368f3edb..dd0b33f12a99 100644 --- a/web_dialog_size/static/description/index.html +++ b/web_dialog_size/static/description/index.html @@ -372,7 +372,7 @@

Web Dialog Size

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:a306b45986bf786b971c49a98fb0d1a7af7ca0317b0eee223c5bb7bf8505d836 +!! source digest: sha256:74af38a912a67506f943a841efc785a9614a64ef5dcf8283afa1f3c3200b2817 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

A module that lets the user expand/restore the dialog box size through a @@ -448,6 +448,7 @@

Contributors

  • Jairo Llopis
  • Ernesto Tejeda
  • Carlos Roca
  • +
  • Sergio Teruel
  • Sudhir Arya <sudhir@erpharbor.com>
  • diff --git a/web_dialog_size/static/src/js/web_dialog_size.esm.js b/web_dialog_size/static/src/js/web_dialog_size.esm.js index c467d99562b4..76b1992536e8 100644 --- a/web_dialog_size/static/src/js/web_dialog_size.esm.js +++ b/web_dialog_size/static/src/js/web_dialog_size.esm.js @@ -1,4 +1,4 @@ -import {Component, onMounted, onWillRender} from "@odoo/owl"; +import {Component, onMounted, onWillRender, useState} from "@odoo/owl"; import {ActionDialog} from "@web/webclient/actions/action_dialog"; import {Dialog} from "@web/core/dialog/dialog"; import {SelectCreateDialog} from "@web/views/view_dialogs/select_create_dialog"; @@ -31,6 +31,9 @@ export class ExpandButton extends Component { setup() { this.orm = useService("orm"); this.last_size = this.props.getsize(); + // The props never change, so the dialog rendering does not render + // this button again: keep the size in its own state to switch icons + this.state = useState({size: this.last_size}); this.config = this.orm.call( "ir.config_parameter", "get_web_dialog_size_config" @@ -41,7 +44,7 @@ export class ExpandButton extends Component { this.config .then(function (r) { if (r.default_maximize) { - self.props.setsize("dialog_full_screen"); + self.setSize("dialog_full_screen"); } }) .catch(() => { @@ -50,14 +53,19 @@ export class ExpandButton extends Component { }); } + setSize(size) { + this.props.setsize(size); + this.state.size = size; + } + dialog_button_extend(ev) { resetListColumnWidths(ev.currentTarget); - this.props.setsize("dialog_full_screen"); + this.setSize("dialog_full_screen"); } dialog_button_restore(ev) { resetListColumnWidths(ev.currentTarget); - this.props.setsize(this.last_size); + this.setSize(this.last_size); } } diff --git a/web_dialog_size/static/src/xml/ExpandButton.xml b/web_dialog_size/static/src/xml/ExpandButton.xml index 87ea9472d202..2aa7e90b6735 100644 --- a/web_dialog_size/static/src/xml/ExpandButton.xml +++ b/web_dialog_size/static/src/xml/ExpandButton.xml @@ -2,7 +2,7 @@