From 6608a5389174f19fafd577f72c7fd069a3b98fc2 Mon Sep 17 00:00:00 2001 From: Zakaria Makrelouf Date: Tue, 29 Aug 2017 13:38:37 +0100 Subject: [PATCH] [9.0][FIX]web_advanced_search_x2x:check logical operator before adding element to the domain (#711) --- web_advanced_search_x2x/__openerp__.py | 2 +- .../static/src/js/web_advanced_search_x2x.js | 25 +++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/web_advanced_search_x2x/__openerp__.py b/web_advanced_search_x2x/__openerp__.py index 738746e2..f18c81da 100644 --- a/web_advanced_search_x2x/__openerp__.py +++ b/web_advanced_search_x2x/__openerp__.py @@ -5,7 +5,7 @@ { "name": "Search x2x fields", - "version": "9.0.1.0.0", + "version": "9.0.1.0.1", "author": "Therp BV, " "Tecnativa, " "Odoo Community Association (OCA)", diff --git a/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js b/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js index 0684aa16..646c35de 100644 --- a/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js +++ b/web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js @@ -123,18 +123,33 @@ odoo.define('web_advanced_search_x2x.search_filters', function (require) { event.stopPropagation(); }); }, + is_logical_operator: function(element){ + // test whether a element is a logical operator ('|' or '&', '!') + if (element === '|' || element === '&' || element === '!') { + return true; + } + else{ + return false; + } + }, get_domain: function () { // Special way to get domain if user chose "domain" filter + var self = this; if (this.get_operator() == "domain") { var value = this._x2x_field.get_value(); var domain = new data.CompoundDomain(), name = this.field.name; $.map(value, function (el) { - domain.add([[ - _.str.sprintf("%s.%s", name, el[0]), - el[1], - el[2], - ]]); + if (self.is_logical_operator(el)){ + domain.add([el]); + } + else { + domain.add([[ + _.str.sprintf("%s.%s", name, el[0]), + el[1], + el[2], + ]]); + } }); return domain; } else {