[FIX] point_of_sale: localeCompare is not a function when name is false

When the loaded res.partner has `name` = false, the call to localeCompare
fails because boolean doesn't have the method. Note that `name` field
of res.partner can be false because no default is specified in its
declaration in the base module.

closes odoo/odoo#80501

X-original-commit: 9b4daee15f901f53239fffdf27a9b42c78dac3e5
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
This commit is contained in:
Joseph Caburnay
2021-11-29 10:34:00 +00:00
parent 2816537999
commit 7f2eda43ce
@@ -74,7 +74,7 @@ odoo.define('point_of_sale.ClientListScreen', function(require) {
} else {
res = this.env.pos.db.get_partners_sorted(1000);
}
return res.sort(function (a, b) { return a.name.localeCompare(b.name) });
return res.sort(function (a, b) { return (a.name || '').localeCompare(b.name || '') });
}
get isNextButtonVisible() {
return this.state.selectedClient ? true : false;