Enable Dark Mode!
how-to-create-a-search-panel-in-odoo-19.jpg
By: Abhinraj R

How to Create a Search Panel in Odoo 19

Technical Odoo 19 Odoo Enterprises Odoo Community

In Odoo 19, the search panel is a very useful feature that allows users to navigate and refine records with just a few clicks. By categorizing data such as product categories, customer types, or record statuses, search panels make it easier to explore information without repeatedly configuring filters.

In this blog, we’ll walk you through the step-by-step process of creating a search panel in Odoo 19. You’ll learn the XML structure, how to extend existing search views, and how to customize filters for your specific use case. By the end, you’ll be able to add search panels to any Odoo model, enhancing usability and improving the overall user experience.

For example, you can see the search panel in the Lunch module. The user can filter out the records using the filters.

How to Create a Search Panel in Odoo 19-cybrosys

The search panel usually appears on the left side of the interface, offering an intuitive way for users to switch between various filters.

Steps to Create a Search Panel in Odoo 19

  1. Identify the Target Model and Search View
  2. First, decide which model needs a search panel. For this example, we’ll use the Product Template model (product.template). Its default search view is product.product_template_search_view.

  3. Create the XML View File
  4. We can create a search panel for the product model.Here is an example of the XML code for the search panel:

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<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" 
                      icon="fa-filter" 
                      string="Category" 
                      select="multi"/>
               <field name="type" 
                      icon="fa-files-o"/>
           </searchpanel>
       </search>
   </field>
</record>
</odoo>

In this example, we inherited the product view to add a search panel inside it. Within the <searchpanel> tag, you can specify the fields to be used as filters.

Each <field> inside the search panel corresponds to a field in the model. You can include any type of field, such as many-to-one, many-to-many, or selection fields, allowing users to refine data quickly without additional navigation.You can also add optional attributes like:

  • icon – to display a visual symbol next to the filter.
  • string – to show a user-friendly label in the panel.
  • select – to decide whether users can select one (single) or multiple (multi) values.
  • enable_counters – to show the count of records available for each filter option.

Here is the result,

How to Create a Search Panel in Odoo 19-cybrosys

Search panels in Odoo 19 offer a practical way to simplify navigation and make large volumes of data more accessible. By configuring attributes such as name, icon, string, select, and domain, developers can design flexible filters that help users quickly find the information they need.

For example, you can filter products by category, employees by department, or sales orders by status—all without relying on complex search queries. This not only saves time but also makes the interface more intuitive for end users. With a few lines of XML, you can add a search panel to your custom module and immediately improve usability across your Odoo applications.

To read more about How to Create a Search Panel in Odoo 18 refer to our blog How to Create a Search Panel in Odoo 18.

FAQs

1. Can I add search panels to custom models?

Yes, you can add a search panel to any model by extending its search view.

2. Can users select multiple options in a search panel?

Yes. By using select="multi" in your <field> tag, users can select multiple filter options at once.

3. Can I display counters next to filters?

Yes. By adding enable_counters="1", Odoo will display the number of records that match each filter option.

4. Does this only work for list views?

No. Search panels can also be applied to kanban views and other list-like views, not just list views.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message