Odoo Help


Can I use field_parent tag in tree view with custom fields?

René Schuster
on 8/20/14, 8:17 AM 3,798 views

For indention between parent and child records in a tree view, there is the field_parent tag in the view definition:

<record id="list_view" model="ir.ui.view">
    <field name="name">model view</field>
    <field name="model">model</field>
    <field name="type">tree</field>
    <field name="field_parent">child_ids</field>
    <field name="arch" type="xml">
        <tree string="Partner Categories">
            . . .
            <field name="parent_id" invisible="1"/>
            . . .

Do I have to use the fields 'parent_id' and 'child_ids' or can I use any fields, like 'my_parent_id' or 'child_object_ids'??

Is the invisible parent_id in the view mandatory?

Is a domain in the view action mandatory: [('parent_id', '=', False)] ?


Does the indention work with list views (view_type: form, view_mode: tree,form)?


Thanks for your help.




| 5 4 7
Bikaner, India

OpenERP Developer at SunARC Technology

On 8/20/14, 9:26 AM

'parent_id'  Field name is mandatory.

In the ORM File Class BaseModel   _parent_name = 'parent_id'   is defined.

And in the Document mentioned parent_left and parent_right are special fields that are related to the parent_id field

'child_ids'  Field name can change.

To Check the sql query:-

select arch,name,field_parent,id,type,inherit_id,model from ir_ui_view where field_parent is not null

Invisible parent_id and domain is Not mandatory. (You can check using the above query arch column).

If you are using parent_id in the domain, action then need to define invisible parent_id.


Thanks to your answer I'm getting closer to the solution for well indented tree views. But it's not working yet for view_type: form and view_mode: tree,form.

René Schuster
on 8/21/14, 4:47 AM

please see the link http://stackoverflow.com/questions/13627600/openerp-tree-structure-indentation-and-color

on 8/21/14, 5:14 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/20/14, 8:17 AM
Seen: 3798 times
Last updated: 3/16/15, 8:10 AM