mirror of https://github.com/OCA/web.git
[IMP] - Improve code
parent
ce91dd0137
commit
d70864e5cd
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue