From a349c47d57c002803cae85c54de8ab8db704c35e Mon Sep 17 00:00:00 2001 From: tafaRU Date: Thu, 19 Nov 2020 15:40:04 +0100 Subject: [PATCH] [FIX] account_financial_report: get module compatible with HomeMenu widget added by web_enterprise module Steps to reproduce: * install account_financial_report module alongside Odoo Enterpise * open General Ledger report * click on View button * click on Home button or by using the shortcut (Shift +h) Current behaviour: Uncaught TypeError: currentController.widget.on_detach_callback is not a function http://localhost:8069/web/static/src/js/chrome/action_manager.js:94 Traceback: TypeError: currentController.widget.on_detach_callback is not a function at Class.on_detach_callback (http://localhost:8069/web/static/src/js/chrome/action_manager.js:94:38) at http://localhost:8069/web/static/src/js/core/dom.js:175:26 at Function._.each._.forEach (http://localhost:8069/web/static/lib/underscore/underscore.js:145:9) at Object.detach (http://localhost:8069/web/static/src/js/core/dom.js:173:11) at http://localhost:8069/web_enterprise/static/src/js/web_client.js:289:21 at http://localhost:8069/web/static/lib/jquery/jquery.js:3276:89 at fire (http://localhost:8069/web/static/lib/jquery/jquery.js:3119:58) at Object.add [as done] (http://localhost:8069/web/static/lib/jquery/jquery.js:3165:49) at Array. (http://localhost:8069/web/static/lib/jquery/jquery.js:3275:77) at Function.each (http://localhost:8069/web/static/lib/jquery/jquery.js:383:58) In addition, after having implemented on_detach_callback, if I click on the icon chevron left or by using the shortcut, I get the following error: Uncaught TypeError: currentController.widget.on_attach_callback is not a function http://localhost:8069/web/static/src/js/chrome/action_manager.js:84 Traceback: TypeError: currentController.widget.on_attach_callback is not a function at Class.on_attach_callback (http://localhost:8069/web/static/src/js/chrome/action_manager.js:84:38) at http://localhost:8069/web/static/src/js/core/dom.js:38:22 at Function._.each._.forEach (http://localhost:8069/web/static/lib/underscore/underscore.js:145:9) at _notify (http://localhost:8069/web/static/src/js/core/dom.js:36:7) at Object.append (http://localhost:8069/web/static/src/js/core/dom.js:60:13) at Class.toggle_home_menu (http://localhost:8069/web_enterprise/static/src/js/web_client.js:305:17) at Class.self.toggle_home_menu (http://localhost:8069/web_enterprise/static/src/js/widgets/debug_manager.js:21:38) at Class._onHideHomeMenu (http://localhost:8069/web_enterprise/static/src/js/web_client.js:329:18) at Class. (http://localhost:8069/web/static/src/js/core/mixins.js:278:23) at Class.trigger (http://localhost:8069/web/static/src/js/core/mixins.js:225:31) --- .../static/src/js/account_financial_report_backend.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/account_financial_report/static/src/js/account_financial_report_backend.js b/account_financial_report/static/src/js/account_financial_report_backend.js index 3dc87d31..b415556c 100644 --- a/account_financial_report/static/src/js/account_financial_report_backend.js +++ b/account_financial_report/static/src/js/account_financial_report_backend.js @@ -104,6 +104,12 @@ odoo.define('account_financial_report.account_financial_report_backend', functio canBeRemoved: function () { return $.when(); }, + on_attach_callback: function () { + this.isInDOM = true; + }, + on_detach_callback: function () { + this.isInDOM = false; + }, }); core.action_registry.add(