[FIX] web: fix in and not in js domain

This commit fix the in and not in operators
in domain.js.

_.contains works only if you have an array
in the left part.

So if you have an array in the right part
it will not work correctly.

Using _.intersection solves the problem.

OPW-2274990

closes odoo/odoo#53150

X-original-commit: 7e3fbfaf5a39f7e26b3a9073144f682086265920
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
This commit is contained in:
jvm-odoo
2020-06-17 11:03:58 +00:00
parent 8060abafbc
commit 61400fdad2
+6 -6
View File
@@ -103,15 +103,15 @@ var Domain = collections.Tree.extend({
case ">=":
return (fieldValue >= this._data[2]);
case "in":
return _.contains(
return _.intersection(
_.isArray(this._data[2]) ? this._data[2] : [this._data[2]],
fieldValue
);
_.isArray(fieldValue) ? fieldValue : [fieldValue],
).length !== 0;;
case "not in":
return !_.contains(
return _.intersection(
_.isArray(this._data[2]) ? this._data[2] : [this._data[2]],
fieldValue
);
_.isArray(fieldValue) ? fieldValue : [fieldValue],
).length === 0;
case "like":
return (fieldValue.toLowerCase().indexOf(this._data[2].toLowerCase()) >= 0);
case "=like":