[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) <qsm@odoo.com>
This commit is contained in:
Younn Olivier
2021-06-15 17:42:02 +00:00
parent f9133d1300
commit 3e82c26c06
+1 -1
View File
@@ -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);
}