mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[IMP] - Improve code
This commit is contained in:
@@ -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);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user