By default, Odoo comes with a bunch of custom filters that can be configured like 'contains', 'is set', 'is not set'. I want to know how to make a custom filter like it starts with. I am able to read documentation how to add more fields to search on, but not how to add more operations to search on.
What can I do to make this basic form of searching possible? Most sql backends have a basic LIKE matching built-in, how do I expose that to end-user in Odoo 11.
In Odoo 11 in the Github repository under addons, you can find the web module, which hosts basic web-framework and related files. Under the web module, there is a file called search_filters.js
This file contains the widget for the extended search menu (the one that shows the custom filters). The way this widget works is that every base primitive (text, number, id) is registered with prefined operations.
In the case of text search, it has the standard contains, equals, is set, is not set commands. All of these constructs a normal domain filter with the standard operators (ilike, !=, =)
etc. So in order to implement a starts with and ends with is adding a new entries, and modifying the javascript to generating the right domain filter e.g. =ilike=query%
or =ilike=%query