I'm trying to recreate the Company's Structure
view from Odoo
.
I have created my model
with parent_id
and child_ids
according to res.company
sample.
But it didn't work. Here is my XML
<record id="open_module_tree_my_department_my" model="ir.actions.act_window">
<field name="name">My Department</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">my.department</field>
<field name="domain">[('parent_id','=',False)]</field>
<field name="view_type">tree</field>
</record>
Here is my model
class MyDepartment(models.Model):
_name = 'my.department'
_description = 'My Department'
name = fields.Char(string="My Department", required=True)
parent_id = fields.Many2one("my.department", "Parent Department", select=True)
child_ids = fields.One2many("my.department", "parent_id", string="Children")
What am I missing?