From 569016bf63e77474bb8e33f17ccb5a7f85b77b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmoda=E2=80=9D?= Date: Tue, 24 Oct 2023 14:08:50 +0200 Subject: [PATCH] [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) --- .../point_of_sale/static/src/app/errors/error_handlers.js | 2 +- .../static/src/app/screens/receipt_screen/receipt_screen.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/app/errors/error_handlers.js b/addons/point_of_sale/static/src/app/errors/error_handlers.js index 9676839a8a9..f42c363b316 100644 --- a/addons/point_of_sale/static/src/app/errors/error_handlers.js +++ b/addons/point_of_sale/static/src/app/errors/error_handlers.js @@ -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; } diff --git a/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt_screen.js b/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt_screen.js index 30a5f7fdcad..f9a1d7e789e 100644 --- a/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt_screen.js +++ b/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt_screen.js @@ -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); + } } }); }