I need to create division field(many2one) and need to group them by their parent department wise. good example I got from hr_view.xml.they categorize by 'manager', 'coach', 'department', etc.. How to add this feature to my own many2one field.?
Please advice..
<record id="view_employee_filter" model="ir.ui.view">
<field name="name">Employees</field>
<field name="model">hr.employee</field>
<field name="arch" type="xml">
<search string="Employees">
<field name="name" string="Employees"/>
<field name="department_id" />
<field name="category_ids" groups="base.group_hr_user"/>
<group expand="0" string="Group By...">
<filter string="Manager" icon="terp-personal" domain="[]" context="{'group_by':'parent_id'}"/>
<filter string="Coach" icon="terp-personal" domain="[]" context="{'group_by':'coach_id'}"/>
<filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
<filter string="Job" icon="terp-gtk-select-all" domain="[]" context="{'group_by':'job_id'}"/>
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
</group>
</search>
</field>
</record>