Odoo gives users the ability to add filtering and group by options to their search views, so that they can easily find the information they need. Additionally, users can set a default group in Odoo, so that the data is automatically grouped when the search view is loaded.
Both Filter and Group By is useful for user to quickly filter data in Odoo. Default group is often used so we can see tally data when a list is first loaded.

Define search view to a model
<record model="ir.actions.act_window" id="action_custom_model"> <field name="name">Custom Model</field> <field name="res_model">custom.model</field> <field name="view_type">form</field> <field name="view_mode">tree,form</field> <field name="view_id" ref="custom_model_view_tree"/> <field name="search_view_id" ref="custom_model_search_form_view"/> <field name="context">{'search_default_group_product': 1}</field> </record>
{'search_default_group_product': 1}
in context means that a filter with name as group_product
is set as default.
Search view
<record id="custom_model_search_form_view" model="ir.ui.view"> <field name="name">custom.model.search.stock.form</field> <field name="model">custom.model</field> <field name="mode">primary</field> <field name="arch" type="xml"> <search string="Custom Model"> <field name="name" string="Name" filter_domain="['|', '|', ('default_code', 'ilike', self), ('name', 'ilike', self), ('barcode', 'ilike', self)]"/> <filter string="State" name="confirm" domain="[('state','=','confirm')]" help="Confirmed Data"/> <group expand="0" name="group_by" string="Group By"> <filter name="group_product" string="Product" domain="[]" context="{'group_by' : 'product_id'}"/> </group> </search> </field> </record>