Odoo Help

Welcome!

This community 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.

1

How to show the one2many field in the tree view?

By
Drees Far
on 12/14/15, 6:26 AM 1,428 views

Hello!!

Please guys, is there a way to show the elements of a One2Many field in the TREE VIEW??!!

Is here any suggestion.

Thanks a lot in advance.

Best Regards.

0
amina
On 12/14/15, 10:39 AM

try this as an exempl:

this code will be in the .py file in a certain class named equipement:

'centre_id':fields.many2one('cvt.centre','_Centre',select=True,required=True),

and here is declaration of the ralated field that I want to show which is placed in a class named centre in the same file:

'properties1':fields.one2many('cvt.equipement','centre_id','_Equipement'),

so the xml file to specify the tree view will be:

<record model="ir.ui.view" id="centre_tree">

<field name="name">centre.tree</field>

<field name="model">cvt.centre</field>

<field name="type">tree</field>

<field name="arch" type="xml">

<tree string="tree">

<field name='name'/>

  ...

<field name='properties1'/>

</tree>

</field>

</record>

 so this will show a new field named _Equipement in center tree view and

hope this helps you

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/14/15, 6:26 AM
Seen: 1428 times
Last updated: 1/18/16, 3:23 PM