From 895414bf67bb5f1d8d6e21afa78b74e412fd3ea7 Mon Sep 17 00:00:00 2001 From: Guillaume-gdi Date: Thu, 26 Oct 2023 14:17:31 +0200 Subject: [PATCH] [FIX] web_editor: reload iframe when header change on controller pages When a user browses a website, he can visit two types of pages: - Static page: the page is a website.page record. - Dynamic / controller page: the page isn't a website.page (e.g. /shop). Some options are only available on static pages, like the option to make the header over the content. Since [this other commit], when a user change the header template, the editor activate/deactivate an extra options in addition to the header template change. The problem is that this extra option may be available only on static pages, and the option to change the header template is available on all pages. Before this commit, if the extra option is not available, we stop the process, the page was not reloaded and the user didn't see the new header template. Now, we just ignore the extra option without stopping the process, so the page is reloaded and the user see the new header. Steps to reproduce the issue fixed by this commit: - Go to /shop - Edit - Change the header template => The header template is not changed. [this other commit]: https://github.com/odoo/odoo/commit/e7dcfc19298948b76caa4c214724c93854cf5f4c task-3572277 closes odoo/odoo#139896 Signed-off-by: Benjamin Vray (bvr) --- addons/web_editor/static/src/js/editor/snippets.options.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index e4a386784e5..2807f3db9bb 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -4395,11 +4395,10 @@ const SnippetOptionWidget = Widget.extend({ } // Check linked widgets: force their value and simulate a notification + // It is possible that we don't have the widget, we continue because a + // reload might be needed. For example, change template header without + // being on a website.page (e.g: /shop). const linkedWidgets = this._requestUserValueWidgets(...ev.data.triggerWidgetsNames); - if (linkedWidgets.length !== ev.data.triggerWidgetsNames.length) { - console.warn('Missing widget to trigger'); - return; - } let i = 0; const triggerWidgetsValues = ev.data.triggerWidgetsValues; for (const linkedWidget of linkedWidgets) {