From d2529bbdc6bc1ab479cb2180a19e84ebc02847b1 Mon Sep 17 00:00:00 2001 From: "Achraf (abz)" Date: Fri, 4 Feb 2022 07:28:16 +0000 Subject: [PATCH] [FIX] point_of_sale: Fix crash in ClientListScreen In some cases load_new_partners returns a rejected promise with an argument of type string, which causes a crash in the catch which considers that it is an rpc error using error.message.code and this is an error because error is a string in the case of a reject on load_new_partners opw-2679837 closes odoo/odoo#84019 X-original-commit: c1ab58324f22ec51a63e1428072eea293d6ae99d Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Achraf --- .../static/src/js/Screens/ClientListScreen/ClientListScreen.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/Screens/ClientListScreen/ClientListScreen.js b/addons/point_of_sale/static/src/js/Screens/ClientListScreen/ClientListScreen.js index 9c18b677c3b..0b0be008067 100644 --- a/addons/point_of_sale/static/src/js/Screens/ClientListScreen/ClientListScreen.js +++ b/addons/point_of_sale/static/src/js/Screens/ClientListScreen/ClientListScreen.js @@ -6,6 +6,7 @@ odoo.define('point_of_sale.ClientListScreen', function(require) { const { useListener } = require('web.custom_hooks'); const { Observer, debounce } = owl; + const { isConnectionError } = require('point_of_sale.utils'); /** * Render this screen using `showTempScreen` to select client. @@ -163,7 +164,7 @@ odoo.define('point_of_sale.ClientListScreen', function(require) { this.state.detailIsShown = false; this.render(); } catch (error) { - if (error.message.code < 0) { + if (isConnectionError(error)) { await this.showPopup('OfflineErrorPopup', { title: this.env._t('Offline'), body: this.env._t('Unable to save changes.'),