From 3e82c26c06b3afae0e94eba3200e76e2c39113cb Mon Sep 17 00:00:00 2001 From: Younn Olivier Date: Tue, 1 Jun 2021 08:43:15 +0000 Subject: [PATCH] [FIX] website: correctly destroy autohideMenu widget When changing the color of the header with the custom colorpicker and saving the changes, the autohideMenu widget was destroyed before finishing the rendering. The commit fixes the destroy method of this widget, testing if the variables are defined before using them. task-2519545 closes odoo/odoo#72193 X-original-commit: c003c8d0620c6eda8f8b482d7519ca00a3007d03 Signed-off-by: Quentin Smetz (qsm) --- addons/website/static/src/js/content/menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/static/src/js/content/menu.js b/addons/website/static/src/js/content/menu.js index 34900c380d3..71f74ab5cbd 100644 --- a/addons/website/static/src/js/content/menu.js +++ b/addons/website/static/src/js/content/menu.js @@ -451,7 +451,7 @@ publicWidget.registry.autohideMenu = publicWidget.Widget.extend({ */ destroy() { this._super(...arguments); - if (!this.noAutohide) { + if (!this.noAutohide && this.$topMenu) { $(window).off('.autohideMenu'); dom.destroyAutoMoreMenu(this.$topMenu); }