[FIX] point_of_sale: error handling

Before, error handling didn't work in point_of_sale when offline.
This was due to poor error handling.

Now, the "limited functionnalities" popup is displayed correctly.

closes odoo/odoo#140037

Related: odoo/enterprise#49705
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
“moda”
2023-10-30 16:41:42 +00:00
committed by David Monnom (moda)
parent ffc001b4c3
commit 569016bf63
2 changed files with 6 additions and 2 deletions
@@ -26,7 +26,7 @@ function rpcErrorHandler(env, error, originalError) {
registry.category("error_handlers").add("rpcErrorHandler", rpcErrorHandler);
function offlineErrorHandler(env, error, originalError) {
if (error instanceof ConnectionLostError) {
if (error instanceof ConnectionLostError || originalError instanceof ConnectionLostError) {
env.services.popup.add(OfflineErrorPopup);
return true;
}
@@ -33,7 +33,11 @@ export class ReceiptScreen extends Component {
// When the order is paid, if there is still a part of the order
// to send in preparation it is automatically sent
if (this.pos.orderPreparationCategories.size) {
await this.pos.sendOrderInPreparation(this.currentOrder);
try {
await this.pos.sendOrderInPreparation(this.currentOrder);
} catch (error) {
Promise.reject(error);
}
}
});
}