Odoo - Advanced Search

Is it possible to expand the search and add several boxes or flags for the convenience of users?

Right now there is only one search box, and for a while the user does not want to click on the search field, and then type and then filter or select their own filter from the filter from the filter plugin. It will be quick if I can check the boxes.

+5
source share
2 answers

Here is an example of expanding the type of search in the form thereof:

odoo.define('modulename.makesearch', function (require) { "use strict"; var searchView = require('web.SearchView'); var search_filters = require('web.search_filters'); var search_inputs = require('web.search_inputs'); var Widget = require('web.Widget'); var FavoriteMenu = require('web.FavoriteMenu'); var FilterMenu = require('web.FilterMenu'); var GroupByMenu = require('web.GroupByMenu'); var Model = require('web.DataModel'); var SearchFilterButton = searchView.include({ init: function(parent, dataset, view_id, defaults, options) { this._super.apply(this, arguments); this.parent = parent; }, view_loaded: function (r) {}, }); }); //Here in view loaded function I wrote the definitions I need. //Here you write your own. 

If you need to make changes to the presentation of the tree and kanban, you must expand them as described above. If you need to add a new search box, you can expand the tree template from the Internet and make the appropriate changes.

0
source

Just expand the search box, like everyone else, and add predefined filters, for example: (see, for example, "view_res_partner_filter")

 ... <field name="arch" type="xml"> ... <filter string="My First Value" domain="[('my_field','=', 'my_first_value')]"/> <filter string="My Second Value" domain="[('my_field','=', 'my_second_value')]"/> ... </field> 

These predefined filters will appear in the "Filters" section under the "search box" and then can be switched by clicking (like your preferred checkbox behavior)

If you insist on using the checkboxes, you will have to do a lot of work, for example, change the corresponding Qweb templates, as well as change the corresponding JS file (see the answer "Burmese Pythis") Therefore, I would prefer this solution if you need time or money.

0
source

Source: https://habr.com/ru/post/1271056/


All Articles