[FIX] point_of_sale: show the loading PoS data error
Before this commit, if there was an error, the PoS stays on the loading page which was confusing for the user. owp-3834647 closes odoo/odoo#159710 Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
This commit is contained in:
committed by
Pedram (pebr)
parent
c6b6b709ef
commit
6418638662
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user