[FIX] web_editor: close widgets before updating the left panel

Part of https://github.com/odoo/odoo/pull/42136
This commit is contained in:
qsm-odoo
2019-12-19 10:06:29 +00:00
parent e51358b8ce
commit d08023f06a
@@ -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();
},
});