Skip to Content
Menu
This question has been flagged

I'm trying to see if there is a way to change the order of items that are displayed in the search panel. I have specific need for the order I want my items to be displayed.

Currently search panel has items out of order and I can't find the logic it's built with.

I’m trying to reorder it so it shows in this order: distribution, awaiting approval, done. Currently it is displaying it in this order: awaiting approval, distribution, done


Avatar
Discard

yes there is a way but could you share what it's exactly the search view that you are referring too? also what did you already tried that you mentioned but not explained

Author

When you create a search view, you can create a panel that will be displayed on the left of the screen. It has different items that I need to be displayed in a specific order. I tried to create groups and use Group By and use Order By, both in search view and tree view but that didn't work. I also tried to update my python code and create compute state sequence, but that didn't work either. Here is my search view xml code for reference:

<record id="view_vendor_bill_search" model="ir.ui.view">
<field name="name">vendor.bill.search</field>
<field name="model">vendor.bill</field>
<field name="arch" type="xml">
<search>
<field name="vendor_name" string="Vendor" filter_domain="['|', ('vendor_name', 'ilike', self), ('vendor_invoice_number', 'ilike', self)]"/>
<searchpanel>
<field name="state" icon="fa-folder-open" enable_counters="1" select="multi"/>
</searchpanel>
</search>
</field>
</record>

Best Answer

Hello!

The order of items in the search panel is usually determined by the database order or the default sorting applied by Odoo. To customize it, you can modify the search panel’s order parameter in the XML view or override it in Python.

Try this:

1. Go to Developer Mode and edit the related view.

2. Locate the <searchpanel> tag and check if an order="field_name" attribute is set.

3. If not, try adding order="sequence" (or another field that controls sorting).

4. If the order is not stored in a specific field, consider adding a custom Many2one or Selection field with a defined order.

5. If sorting isn’t working as expected, you might need to override the search panel logic in the corresponding model’s search_read() method. 

Avatar
Discard
Related Posts Replies Views Activity
1
Sep 20
5606
0
Sep 21
1388
1
Mar 15
6299
1
Aug 25
1489
1
Mar 25
2081