From 3e4c37ec6b3ae5db342a5dc86ed342eee38206c0 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Thu, 24 Jun 2021 14:19:03 +0000 Subject: [PATCH] [FIX] point_of_sale: correctly block ui when sending RPC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, the block UI component was not visible so the interface was not blocked when sending RPC (at least). After this commit, the block UI works correctly closes odoo/odoo#72727 Signed-off-by: Géry Debongnie (ged) --- addons/point_of_sale/__manifest__.py | 3 +++ addons/point_of_sale/static/src/js/chrome_adapter.js | 7 +++++-- addons/point_of_sale/views/pos_assets_common.xml | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/__manifest__.py b/addons/point_of_sale/__manifest__.py index 43731fe2a86..dfa8efa335d 100644 --- a/addons/point_of_sale/__manifest__.py +++ b/addons/point_of_sale/__manifest__.py @@ -168,6 +168,9 @@ ('remove', 'web/static/src/core/errors/error_handlers.js'), ('remove', 'web/static/src/legacy/legacy_rpc_error_handler.js'), ], + 'point_of_sale.pos_assets_backend_style': [ + "web/static/src/core/ui/**/*.scss", + ], 'point_of_sale.tests_assets': [ 'web/static/lib/daterangepicker/daterangepicker.css', 'web/static/lib/qunit/qunit-2.9.1.css', diff --git a/addons/point_of_sale/static/src/js/chrome_adapter.js b/addons/point_of_sale/static/src/js/chrome_adapter.js index d5fd0a42288..0e50ed0a24d 100644 --- a/addons/point_of_sale/static/src/js/chrome_adapter.js +++ b/addons/point_of_sale/static/src/js/chrome_adapter.js @@ -8,8 +8,7 @@ import { configureGui } from "point_of_sale.Gui"; import { useBus } from "@web/core/bus_hook"; import PosComponent from "point_of_sale.PosComponent"; import PopupControllerMixin from "point_of_sale.PopupControllerMixin"; -import { useErrorHandlers } from "point_of_sale.custom_hooks"; -import { ConnectionLostError } from "@web/core/network/rpc_service"; +import { registry } from "@web/core/registry"; function setupResponsivePlugin(env) { const isMobile = () => window.innerWidth <= 768; @@ -32,7 +31,11 @@ export class ChromeAdapter extends PopupControllerMixin(PosComponent) { useBus(this.env.qweb, "update", () => this.render()); const chrome = owl.hooks.useRef("chrome"); owl.hooks.onMounted(async () => { + // Little trick to avoid displaying the block ui during the POS models loading + const BlockUiFromRegistry = registry.category("main_components").get("BlockUI"); + registry.category("main_components").remove("BlockUI"); await chrome.comp.start(); + registry.category("main_components").add("BlockUI", BlockUiFromRegistry); configureGui({ component: chrome.comp }); setupResponsivePlugin(this.env); }); diff --git a/addons/point_of_sale/views/pos_assets_common.xml b/addons/point_of_sale/views/pos_assets_common.xml index a1d14a64081..70904f9c4ac 100644 --- a/addons/point_of_sale/views/pos_assets_common.xml +++ b/addons/point_of_sale/views/pos_assets_common.xml @@ -2,6 +2,7 @@