[FIX] lunch: search domain type

To reproduce
============
- on Lunch set a filter and try to save it to favorites
an error is raised

Problem
=======
at this line https://github.com/odoo/odoo/blob/16.0/addons/web/static/src/search/search_model.js#L1771
we are expecting `_getDomain` to return a Domain, but the overrided version
on Lunch returns a List, so when we are calling `toString` it's not the one defined
in `Domain.js` that will be called but the default one defined by JS, which
is not expected in the rest of the process.

Solution
========
`_getDomain` return type depends on the boolean `params.raw`, if it's `True`
we return a Domain else we return a List.

opw-3435524

closes odoo/odoo#132931

X-original-commit: ce21a4bc1057c251d39e44da30dd5ffadf354e4d
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
Signed-off-by: Abdelouahab Laaroussi (abla) <abla@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2023-08-24 01:07:03 +02:00
parent fdea4ee0e0
commit b6ce915eef
@@ -58,10 +58,10 @@ export class LunchSearchModel extends SearchModel {
if (!this.lunchState.locationId) {
return domain;
}
return Domain.and([
const result = Domain.and([
domain,
[['is_available_at', '=', this.lunchState.locationId]]
]).toList();
]);
return params.raw ? result : result.toList();
}
}