I have a selection field 'state' which has values like resolved, dismissed, closed.
I have grouped records by 'state' field but how can we group records by field values, in this case, by resolved, dismissed and closed?
<group extend="0" string="Group By">
<filter name="attachment_type" string="attachment Type" context="{'group_by' : 'attachment_type'}"></filter>
<filter name="state" string="Issue Status" context="{'group_by': 'state'}"></filter>
</group>
That can be achieved by specifying domain in filter.
<filter string="Resolved" domain="[('state','=','resolved')]" />
<separator/>
<filter string="Dismissed" domain="[('state','=','dismissed')]" />
<separator/>
<filter string="Closed" domain="[('state','=','closed')]" />
It will create 3 filters, once you choose any filter that will filter result set by conditions which you have specified in domain.
In order to generate group by for all these three you need to specify the same domain by creating three separate filter for group by.
<group extend="0" string="Group By">
<filter name="attachment_type" string="attachment Type" context="{'group_by' : 'attachment_type'}"></filter>
<filter name="state_resolved" string="Resolved" context="{'group_by': 'state'}" domain="[('state','=','resolved')]" ></filter>
<filter name="state_dismissed" string="Dismissed" context="{'group_by': 'state'}" domain="[('state','=','dismissed')]" ></filter>
<filter name="state_closed" string="Closed" context="{'group_by': 'state'}" domain="[('state','=','closed')]" ></filter>
</group>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With