如何为部门Odoo 10创建嵌套树视图

时间:2017-10-26 10:39:25

标签: python-2.7 treeview openerp odoo-10 odoo-view

我想在odoo v 10.0中为我的部门提供可视化,如下所示:

Parent Department 1

    -> Child department 1
          --> Job position of this department

          --> Job position of this department
     -> Child department 2

          --> Job position of this department

          --> Job position of this department
Parent department 2

而不是简单地拥有父部门/子部门

如何实现这一目标?我应该在视图中使用分组或迭代还是其他东西?如果可能 - 请举例说明

1 个答案:

答案 0 :(得分:1)

试试这段代码:

<record id="action_hr_department_test" model="ir.actions.act_window">
    <field name="name">Departments</field>
    <field name="res_model">hr.department</field>
    <field name="view_type">tree</field>
    <field name="view_mode">tree,form</field>
   <field name="domain">[]</field>
    <field name="context">{'group_by':['parent_id','name','manager_id']}</field>
</record>

<menuitem id="menu_hr_department_test" name="Departments Test"
         action="action_hr_department_test"/>

希望它会对你有所帮助。