From 6855cc3d2c8c5c0dc3fdf4ab1b990184acb879e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Mon, 26 Apr 2021 13:37:05 +0000 Subject: [PATCH] [FIX] web: prevent test_menus loading DiscussWidget if no mail module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow up on bd67479316dfb19021de06b7007d2ae3c84284e3 This test file is not respecting Odoo module dependencies. If the module is not defined, calling `[Symbol.for("default")]` will crash. Old require system didn't have this syntax, the similar guard was done just before using the class. closes odoo/odoo#69845 Signed-off-by: Xavier Dollé (xdo) --- addons/web/static/src/js/tools/test_menus.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/tools/test_menus.js b/addons/web/static/src/js/tools/test_menus.js index c0ef0bbedef..09166f01cb5 100644 --- a/addons/web/static/src/js/tools/test_menus.js +++ b/addons/web/static/src/js/tools/test_menus.js @@ -14,7 +14,10 @@ function createWebClientHooks() { var AbstractController = odoo.__DEBUG__.services['web.AbstractController']; - var DiscussWidget = odoo.__DEBUG__.services['@mail/widgets/discuss/discuss'][Symbol.for("default")]; + // This test file is not respecting Odoo module dependencies. + // The following module might not be loaded (eg. if mail is not installed). + const DiscussWidgetModule = odoo.__DEBUG__.services['@mail/widgets/discuss/discuss']; + const DiscussWidget = DiscussWidgetModule && DiscussWidgetModule[Symbol.for("default")]; var WebClient = odoo.__DEBUG__.services["web.WebClient"]; WebClient.include({