From 7ddcebfcda47422117650e3f40e45b6de31cf306 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Sun, 29 Aug 2021 12:48:36 +0000 Subject: [PATCH] [FIX] point_of_sale: prevent menu_service from loading Before this commit, the menu_service was not included into the pos.assets_backend bundle which was fine until menu_service defined a helper function that other service would need. Since pos.assets_backend imports virtually all web.assets_backend, there was dependencies errors. Hence the need to import the menu_service as well, but making sure it doesn't make the rpc to load the menus. After this commit, there are no dependency issues, and the menus are not loaded, as expected and as before. Part-of: odoo/odoo#75396 --- addons/point_of_sale/__manifest__.py | 1 - addons/point_of_sale/views/pos_assets_index.xml | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/__manifest__.py b/addons/point_of_sale/__manifest__.py index 5751921a465..e4c2c85e1f2 100644 --- a/addons/point_of_sale/__manifest__.py +++ b/addons/point_of_sale/__manifest__.py @@ -171,7 +171,6 @@ ], 'point_of_sale.pos_assets_backend': [ ('include', 'web.assets_backend'), - ('remove', 'web/static/src/webclient/menu_service.js'), ('remove', 'web/static/src/core/errors/error_handlers.js'), ('remove', 'web/static/src/legacy/legacy_rpc_error_handler.js'), ], diff --git a/addons/point_of_sale/views/pos_assets_index.xml b/addons/point_of_sale/views/pos_assets_index.xml index 0618568fe29..599077081ce 100644 --- a/addons/point_of_sale/views/pos_assets_index.xml +++ b/addons/point_of_sale/views/pos_assets_index.xml @@ -32,6 +32,9 @@ 'login_number': login_number, 'debug': debug, })"/>; + // Prevent the menu_service to load anything. In an ideal world, POS assets would only contain + // what is genuinely necessary, and not the whole backend. + odoo.loadMenusPromise = Promise.resolve(); odoo.loadTemplatesPromise = fetch(`/web/webclient/qweb/${odoo.__session_info__.cache_hashes.qweb}?bundle=web.assets_qweb`).then(doc => doc.text());