diff --git a/addons/point_of_sale/static/src/app/main.js b/addons/point_of_sale/static/src/app/main.js index 426d0cea521..6153c1cc5fb 100644 --- a/addons/point_of_sale/static/src/app/main.js +++ b/addons/point_of_sale/static/src/app/main.js @@ -9,6 +9,7 @@ import { hasTouch } from "@web/core/browser/feature_detection"; import { localization } from "@web/core/l10n/localization"; import { makeEnv, startServices } from "@web/env"; import { session } from "@web/session"; +import { RPCError } from "@web/core/network/rpc_service"; const loader = reactive({ isShown: true }); whenReady(() => { @@ -28,6 +29,19 @@ whenReady(() => { // setup environment const env = makeEnv(); await startServices(env); + + // handle loading PoS error + if (env.services.pos instanceof Error) { + let message = _t("An error occurred while loading the Point of Sale: \n"); + if (env.services.pos instanceof RPCError) { + message += env.services.pos.data.message; + } else { + message += env.services.pos.message; + } + window.alert(message); + window.location = "/web#action=point_of_sale.action_client_pos_menu"; + } + // start application await whenReady(); const app = new App(Chrome, {