Search code examples
odoo-11

How to add "Group By" to Tree View in Odoo V11?


I am new in odoo.

I have a tree view , i want to show it by default with grouped by according to my stage_id.

Any one help me.

Thanks


Solution

  • <field name="name">dmr.search.view</field>   
    
    <field name="model">model.name</field>   
    
    <field name="arch" type="xml">       
    
        <search string="DMR">           
    
            <filter name="group_customer_id" string="Customer" icon="terp-partner" context="{'group_by':'field_name'}"/>       
    
        </search>   
    
    </field>
    

    After adding search record, you need to add search_view_id in action.

    For Ex :-

    In action

    <field name="search_view_id" ref="dmr_search_view"/>
    

    I hope it works for you