Odoo 16 Development Book

Filters and Group By:

There are filters and groups by in the search view. Records are filtered based on conditions using the filter command, and groups are grouped based on a field using the group by command. There is a simple way to add these by default, so you don't have to constantly select "Add Custom Filter" or "Add Custom Group."The search tag's filter tag is used to add a filter.

For eg:

<filter string="Gender" name="gender"
       context="{'group_by': 'gender'}"/>
odoo Development

You will see all the archived records when you select the archived filter. Different filtering conditions can be specified in the domain attribute. If you choose to group by, you can include filters both inside the group tag and the search tag.

i.e.,

<group expand="0" string="Group By">
        <filter string="Gender" name="gender" context="{'group_by': 'gender'}"/>
       </group>
odoo Development

Applying a gender grouping here.The data will be sorted according to the gender field. Context is used to pass data for grouping. While other fields can also be used for the group by filters, the attribute name is necessary.

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