[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) <jcb@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
This commit is contained in:
Achraf (abz)
2022-02-04 19:44:45 +00:00
parent ee324e8374
commit d2529bbdc6
@@ -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.'),