Odoo is an open-source ERP platform that empowers businesses of all sizes to streamline their operations, boost productivity, and stay ahead in today’s dynamic market. The Search Panel in Odoo 17 is a robust feature that seamlessly merges simplicity with advanced filtering capabilities. The Search Panel offers a user-friendly interface to effortlessly retrieve specific information, making data exploration and analysis a streamlined and efficient process. Examples of the search panel can be seen in the Employees and Lunch modules.
This is the search panel view in the Lunch module. The user can filter out the records using the filters.
Now, let’s see how to create a search panel in existing modules and custom modules in Odoo 17.
We can create a search panel for the product model.
This is the XML code for the search panel:
<record id="product_template_search_panel" model="ir.ui.view">
<field name="name">product.template.search.panel</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<search position="inside">
<searchpanel>
<field name="categ_id" enable_counters="1" icon="fa fa-filter"/>
<field name="detailed_type" icon="fa-files-o"/>
</searchpanel>
</search>
</field>
</record>
Here, the search panel is included in the products page based on the field product category.
Filtering is done based on the fields we mention inside the searchpanel tag. Some of the possible attributes for the fields are NAME, ICON, LIMIT, and ENABLE_COUNTERS.
In the Name Attribute, you can mention the field name based on which you need filtering. You can give one or more field names inside the search panel tag.
You can specify the Icon for visually representing the string.
Enable_counters is set to True if we want to show the number of records for each value. By default, it is zero.
Here’s the output.
The primary purpose of this search panel is to effortlessly filter objects of interest, allowing the addition of any field to a model, be it a custom module or an existing one. Enhance its visual appeal by incorporating stylish icons and fonts, making it a distinctive method of creation. Refer to our previous blog how to create search panel in odoo 16 to read more about search panel creation in odoo.