summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvm-odoo <jvm@odoo.com>2020-06-15 11:22:03 +0000
committerjvm-odoo <jvm@odoo.com>2020-06-17 11:03:58 +0000
commit61400fdad2909ad2ae4481dff8a2e1942420f23e (patch)
treef6a7bb43a5daa615513af03998e8da76f3712842
parent8060abafbc5537d0cbb9aebb92ad8a5cdcd8ce79 (diff)
[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>
-rw-r--r--addons/web/static/src/js/core/domain.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/addons/web/static/src/js/core/domain.js b/addons/web/static/src/js/core/domain.js
index ad0cfba9ae4..3e3fd4e4201 100644
--- a/addons/web/static/src/js/core/domain.js
+++ b/addons/web/static/src/js/core/domain.js
@@ -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":