From 2385e58d76aa5e4bca0fc6d76ecedc7de5fd4267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 10 Feb 2021 13:49:26 +0000 Subject: [FIX] web, point_of_sale: update owl to v1.2.4 This commit update owl from 1.2.3 to 1.2.4, and introduces a few fixes for code that was broken (because it accesses private owl values) Note the fix for the test menu code is interesting. Before this commit, the handler for the click on the home menu component was not called, so the click had a side effect: it modified the url to its href, which caused the action manager to load the next application, even though the home menu was not mounted. With the update to Owl, this is no longer true: the handler is called, and call preventDefault on the event. Because of that, the url is not changed. However, since the home menu is itself not mounted, it cannot communicate to the web client that we should load the next app. This is why it was broken. The fix is simple: we actually make sure that the home menu is displayed before clicking on the app menuitem. closes odoo/odoo#65886 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/src/js/tools/test_menus.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src/js/tools/test_menus.js') diff --git a/addons/web/static/src/js/tools/test_menus.js b/addons/web/static/src/js/tools/test_menus.js index 3b0523d8f65..9112b7f5961 100644 --- a/addons/web/static/src/js/tools/test_menus.js +++ b/addons/web/static/src/js/tools/test_menus.js @@ -106,6 +106,9 @@ console.log("Testing app menu:", element.dataset.menuXmlid); if (testedApps.indexOf(element.dataset.menuXmlid) >= 0) return; // Another infinite loop protection testedApps.push(element.dataset.menuXmlid); + if (isEnterprise) { + await ensureHomeMenu(); + } await testMenuItem(element); if (appsMenusOnly === true) return; const subMenuItems = document.querySelectorAll('.o_menu_entry_lvl_1, .o_menu_entry_lvl_2, .o_menu_entry_lvl_3, .o_menu_entry_lvl_4'); @@ -113,8 +116,7 @@ await testMenuItem(subMenuItem); } if (isEnterprise) { - const homeMenu = document.querySelector('nav.o_main_navbar > a.o_menu_toggle.fa-th'); - return triggerClick(homeMenu, "home menu toggle button"); + await ensureHomeMenu(); } } @@ -276,6 +278,17 @@ return promise; } + /** + * Make sure the home menu is open + */ + async function ensureHomeMenu() { + const menuToggle = document.querySelector('nav.o_main_navbar > a.o_menu_toggle.fa-th'); + if (menuToggle) { + await triggerClick(menuToggle, 'home menu toggle button'); + await waitForCondition(() => document.querySelector('.o_home_menu')); + } + } + const MOUSE_EVENTS = [ 'mouseover', 'mouseenter', -- cgit v1.2.3