From d70864e5cd8197567581a1864313999897702eef Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Fri, 17 Jan 2020 10:08:07 +0100 Subject: [PATCH] [IMP] - Improve code --- web_advanced_search_wildcard/__manifest__.py | 1 - web_advanced_search_wildcard/static/src/js/search.js | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/web_advanced_search_wildcard/__manifest__.py b/web_advanced_search_wildcard/__manifest__.py index 2dedce8be..a4c925693 100644 --- a/web_advanced_search_wildcard/__manifest__.py +++ b/web_advanced_search_wildcard/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2014 initOS GmbH & Co. KG (). # Copyright 2016 Therp BV . # Copyright 2017 Alex Comba - Agile Business Group diff --git a/web_advanced_search_wildcard/static/src/js/search.js b/web_advanced_search_wildcard/static/src/js/search.js index c3f2c3c5b..5eb0e285f 100644 --- a/web_advanced_search_wildcard/static/src/js/search.js +++ b/web_advanced_search_wildcard/static/src/js/search.js @@ -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); } }, });