Browse Source

[ADD] - Add doesn't start/end with options

pull/1326/head
sbejaoui 5 years ago
parent
commit
6fd4995ebb
  1. 6
      web_advanced_search_wildcard/README.rst
  2. 2
      web_advanced_search_wildcard/readme/CONTRIBUTORS.rst
  3. 4
      web_advanced_search_wildcard/readme/DESCRIPTION.rst
  4. 5
      web_advanced_search_wildcard/static/description/index.html
  5. 4
      web_advanced_search_wildcard/static/src/js/search.js

6
web_advanced_search_wildcard/README.rst

@ -25,11 +25,13 @@ Wildcard in advanced search
|badge1| |badge2| |badge3| |badge4| |badge5|
This module adds 3 options to advanced search of char, many2one,
This module adds new options to advanced search of char, many2one,
many2many and one2many fields:
* *starts with* (uses the domain *=ilike %<search string>*),
* *doesn't start with* (uses the domain *not ilike %<search string>*),
* *ends with* (uses the domain *=ilike <search string>%*),
* *doesn't end with* (uses the domain *not ilike <search string>%*),
* *matches* (uses the domain *=ilike <search string>*).
@ -79,7 +81,7 @@ Contributors
* L Freeke <lfreeke@therp.nl>
* Alex Comba <alex.comba@agilebg.com>
* Alexis de Lattre <alexis.delattre@akretion.com>
* Souheil Bejaoui <souheil.bejaoui@acsone.eu>
Maintainers
~~~~~~~~~~~

2
web_advanced_search_wildcard/readme/CONTRIBUTORS.rst

@ -3,4 +3,4 @@
* L Freeke <lfreeke@therp.nl>
* Alex Comba <alex.comba@agilebg.com>
* Alexis de Lattre <alexis.delattre@akretion.com>
* Souheil Bejaoui <souheil.bejaoui@acsone.eu>

4
web_advanced_search_wildcard/readme/DESCRIPTION.rst

@ -1,7 +1,9 @@
This module adds 3 options to advanced search of char, many2one,
This module adds new options to advanced search of char, many2one,
many2many and one2many fields:
* *starts with* (uses the domain *=ilike %<search string>*),
* *doesn't start with* (uses the domain *not ilike %<search string>*),
* *ends with* (uses the domain *=ilike <search string>%*),
* *doesn't end with* (uses the domain *not ilike <search string>%*),
* *matches* (uses the domain *=ilike <search string>*).

5
web_advanced_search_wildcard/static/description/index.html

@ -368,11 +368,13 @@ ul.auto-toc {
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/12.0/web_advanced_search_wildcard"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_advanced_search_wildcard"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module adds 3 options to advanced search of char, many2one,
<p>This module adds new options to advanced search of char, many2one,
many2many and one2many fields:</p>
<ul class="simple">
<li><em>starts with</em> (uses the domain <em>=ilike %&lt;search string&gt;</em>),</li>
<li><em>doesn’t start with</em> (uses the domain <em>not ilike %&lt;search string&gt;</em>),</li>
<li><em>ends with</em> (uses the domain <em>=ilike &lt;search string&gt;%</em>),</li>
<li><em>doesn’t end with</em> (uses the domain <em>not ilike &lt;search string&gt;%</em>),</li>
<li><em>matches</em> (uses the domain <em>=ilike &lt;search string&gt;</em>).</li>
</ul>
<p><strong>Table of contents</strong></p>
@ -421,6 +423,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>L Freeke &lt;<a class="reference external" href="mailto:lfreeke&#64;therp.nl">lfreeke&#64;therp.nl</a>&gt;</li>
<li>Alex Comba &lt;<a class="reference external" href="mailto:alex.comba&#64;agilebg.com">alex.comba&#64;agilebg.com</a>&gt;</li>
<li>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.com">alexis.delattre&#64;akretion.com</a>&gt;</li>
<li>Souheil Bejaoui &lt;<a class="reference external" href="mailto:souheil.bejaoui&#64;acsone.eu">souheil.bejaoui&#64;acsone.eu</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">

4
web_advanced_search_wildcard/static/src/js/search.js

@ -7,7 +7,9 @@ odoo.define('web_advanced_search_wildcard', function (require) {
Char.prototype.operators.push(
{value: "startswith", text: _lt("starts with")},
{value: "not_startswith", text: _lt("doesn't start with")},
{value: "endswith", text: _lt("ends with")},
{value: "not_endswith", text: _lt("doesn't end with")},
{value: '=ilike', text: _lt("matches")}
);
@ -17,7 +19,9 @@ odoo.define('web_advanced_search_wildcard', function (require) {
case '∃': return [[field.name, '!=', false]];
case '∄': return [[field.name, '=', false]];
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 [[field.name, operator.value, this.get_value()]];
}
},

Loading…
Cancel
Save