3
0
Fork 0

[9.0][FIX]web_advanced_search_x2x:check logical operator before adding element to the domain (#711)

9.0
Zakaria Makrelouf 2017-08-29 13:38:37 +01:00 committed by Pedro M. Baeza
parent 3f082a0ba7
commit 6608a53891
2 changed files with 21 additions and 6 deletions

View File

@ -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)",

View File

@ -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 {