[IMP] - Improve code

pull/1326/head
sbejaoui 2020-01-17 10:08:07 +01:00
parent ce91dd0137
commit d70864e5cd
2 changed files with 5 additions and 7 deletions

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2014 initOS GmbH & Co. KG (<http://www.initos.com>).
# Copyright 2016 Therp BV <http://therp.nl>.
# Copyright 2017 Alex Comba - Agile Business Group

View File

@ -15,13 +15,12 @@ odoo.define('web_advanced_search_wildcard', function (require) {
Char.include({
get_domain: function (field, operator) {
var res = this._super(field, operator);
switch (operator.value) {
case 'startswith': return [[field.name, '=ilike', this.get_value() + '%']];
case 'not_startswith': return ['!', [field.name, '=ilike', this.get_value() + '%']];
case 'endswith': return [[field.name, '=ilike', '%' + this.get_value()]];
case 'not_endswith': return ['!', [field.name, '=ilike', '%' + this.get_value()]];
default: return res;
case 'startswith': return [[field.name, '=ilike', this.get_value() + '%']];
case 'not_startswith': return ['!', [field.name, '=ilike', this.get_value() + '%']];
case 'endswith': return [[field.name, '=ilike', '%' + this.get_value()]];
case 'not_endswith': return ['!', [field.name, '=ilike', '%' + this.get_value()]];
default: return this._super(field, operator);
}
},
});