2016-11-25 222 views
3


我有一個選擇字段「狀態」,其值爲resolved, dismissed, closed

我已經按'州'字段對記錄進行了分組,但是我們如何按字段值對記錄進行分組,在這種情況下,通過resolved, dismissed and closedODOO:按字段值分組

<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> 

回答

2

這可以通過在過濾器中指定域來實現。

<filter string="Resolved" domain="[('state','=','resolved')]" /> 
<separator/> 
<filter string="Dismissed" domain="[('state','=','dismissed')]" /> 
<separator/> 
<filter string="Closed" domain="[('state','=','closed')]" /> 

一旦您選擇任何過濾器,它將根據您在域中指定的條件過濾結果集,它將創建3個過濾器。

爲了生成所有這三個分組,您需要通過爲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> 
+0

甜!非常感謝你。 – ashwinx