You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
916 B
25 lines
916 B
odoo.define('web_advanced_search_wildcard', function (require) {
|
|
"use strict";
|
|
|
|
var core = require('web.core');
|
|
var Char = core.search_filters_registry.get('char')
|
|
var _lt = core._lt;
|
|
|
|
Char.prototype.operators.push(
|
|
{value: "startswith", text: _lt("starts with")},
|
|
{value: "endswith", text: _lt("ends with")},
|
|
{value: '=ilike', text: _lt("matches")}
|
|
);
|
|
|
|
Char.include({
|
|
get_domain: function (field, operator) {
|
|
switch (operator.value) {
|
|
case '∃': return [[field.name, '!=', false]];
|
|
case '∄': return [[field.name, '=', false]];
|
|
case 'startswith': return [[field.name, '=ilike', this.get_value() + '%']];
|
|
case 'endswith': return [[field.name, '=ilike', '%' + this.get_value()]];
|
|
default: return [[field.name, operator.value, this.get_value()]];
|
|
}
|
|
},
|
|
});
|
|
});
|