Skip to Content
Menú
This question has been flagged
1 Respondre
10923 Vistes

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"/>
            . . .
        </tree>
    </field>
</record>

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)] ?

EDIT:

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

 

Thanks for your help.

Avatar
Descartar
Best Answer

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

 

Avatar
Descartar
Autor

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.

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

Related Posts Respostes Vistes Activitat
2
de jul. 22
19445
2
de des. 19
10620
1
de maig 16
4845
0
d’oct. 17
4736
1
de gen. 16
14668