forked from Techsystech/web
[9.0][FIX]web_advanced_search_x2x:check logical operator before adding element to the domain (#711)
parent
3f082a0ba7
commit
6608a53891
|
@ -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)",
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue