From d08023f06ae8c211a83414b9164e4c7bcb0f6367 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 18 Dec 2019 17:07:16 +0000 Subject: [PATCH] [FIX] web_editor: close widgets before updating the left panel Part of https://github.com/odoo/odoo/pull/42136 --- .../web_editor/static/src/js/editor/snippets.editor.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 41d5dbb81b6..5d2fb049ea0 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -1262,6 +1262,12 @@ var SnippetsMenu = Widget.extend({ }); return Promise.all(defs); }, + /** + * @private + */ + _closeWidgets: function () { + this.snippetEditors.forEach(editor => editor.closeWidgets()); + }, /** * Creates and returns a set of helper functions which can help finding * snippets in the DOM which match some parameters (typically parameters @@ -1966,6 +1972,7 @@ var SnippetsMenu = Widget.extend({ * @param {OdooEvent} ev */ _onUpdateCustomizeElements: function (ev) { + this._closeWidgets(); while (this.customizePanel.firstChild) { this.customizePanel.removeChild(this.customizePanel.firstChild); } @@ -1983,7 +1990,7 @@ var SnippetsMenu = Widget.extend({ * user value widgets of all editors. */ _onUserValueWidgetOpening: function () { - this.snippetEditors.forEach(editor => editor.closeWidgets()); + this._closeWidgets(); }, });