Browse Source

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

pull/719/head
Zakaria Makrelouf 7 years ago
committed by Pedro M. Baeza
parent
commit
6608a53891
  1. 2
      web_advanced_search_x2x/__openerp__.py
  2. 25
      web_advanced_search_x2x/static/src/js/web_advanced_search_x2x.js

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

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

Loading…
Cancel
Save