Inherit odoo javascript search box Hey guys, i need to inherit this: addons/web/static/src/js/views/control_panel/search/search_filters.js code snippet:
'''var Char = Field.extend({
tagName: 'input',
className: 'o_input',
attributes: {
type: 'text'
},
operators: [
{value: "ilike", text: _lt("contains")},
{value: "not ilike", text: _lt("doesn't contain")},
{value: "=", text: _lt("is equal to")},
{value: "!=", text: _lt("is not equal to")},
{value: "∃", text: _lt("is set")},
{value: "∄", text: _lt("is not set")}
],
get_value: function () {
return this.$el.val();
});
I want to add one more line there, {value: '=ilike', text: _lt("matches")},
I tried inheriting that whole file, and after adding the line nothing happens. Any hint is appreciated. That line comes from the module https://apps.odoo.com/apps/modules/12.0/web_advanced_search_wildcard/ but its only for v12, i need it on v13 and higher. Thanks
You need to update the line where they get the Char
filter reference because core.search_filters_registry
is undefined in Odoo13:
var Char = require('web.search_filters').Char;
Example (adding a new operator to the char filter):
var core = require('web.core');
var Char = require('web.search_filters').Char;
var _lt = core._lt;
Char.prototype.operators.push(
{value: '=ilike', text: _lt("Matches")}
);
You will need to create a new file and add it to an asset bundle (web.assets_backend
).