Skip to content

Commit

Permalink
[FIX] point_of_sale: show the loading PoS data error
Browse files Browse the repository at this point in the history
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#161624

X-original-commit: da88f6b
Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
  • Loading branch information
caburj authored and pedrambiria committed Apr 18, 2024
1 parent 21ed286 commit 7228619
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion addons/point_of_sale/static/src/app/store/pos_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { deduceUrl, getOnNotified } from "@point_of_sale/utils";
import { Reactive } from "@web/core/utils/reactive";
import { HWPrinter } from "@point_of_sale/app/printer/hw_printer";
import { memoize } from "@web/core/utils/functions";
import { ConnectionLostError } from "@web/core/network/rpc";
import { ConnectionLostError, RPCError } from "@web/core/network/rpc";
import { OrderReceipt } from "@point_of_sale/app/screens/receipt_screen/receipt/order_receipt";
import { _t } from "@web/core/l10n/translation";
import { CashOpeningPopup } from "@point_of_sale/app/store/cash_opening_popup/cash_opening_popup";
Expand Down Expand Up @@ -114,6 +114,16 @@ export class PosStore extends Reactive {
pos_data,
}
) {
if (pos_data instanceof Error) {
let message = _t("An error occurred while loading the Point of Sale: \n");
if (pos_data instanceof RPCError) {
message += pos_data.data.message;
} else {
message += pos_data.message;
}
window.alert(message);
window.location = "/web#action=point_of_sale.action_client_pos_menu";
}
this.env = env;
this.numberBuffer = number_buffer;
this.barcodeReader = barcode_reader;
Expand Down

0 comments on commit 7228619

Please sign in to comment.