跳至內容
選單
此問題已被標幟
1 回覆
10952 瀏覽次數

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.

頭像
捨棄
最佳答案

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

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

相關帖文 回覆 瀏覽次數 活動
2
7月 22
19461
2
12月 19
10621
1
5月 16
4845
0
10月 17
4763
1
1月 16
14681