Odoo Help


Is it possible to specify two models in one tree view?

Nanie BE
on 10/15/14, 3:14 AM 1,793 views

I want to add one field of the model purchase.oder.line in the tree view of purchase.order. How to do it? 

Piyush Suva
On 10/15/14, 7:48 AM

if that  'Field' of all the purchase line of particuler purchase order contain same value, Then You can use related field type.

another Idea is to use Function filed. Add one function field in purchase order which calculte proper value form its purchase Line. 

Mudassir Dar
On 10/15/14, 7:39 AM

There is no way of acessing the purchase.order.line date.....u can add new field in purchase order model and call onchange method on order_line and pass same field as an argument.

<field name ='order_line' onchange= "getdate(order_line)"> 

by this way u can specify the defnition of getdate() to fetch the date of purchase order line and insert into purchase order model...

I try to do the function getdata() to fetch the date but i'm stuck. Can you help please. Thanks.

Nanie BE
on 10/15/14, 10:42 AM
Gaurav Marsoniya
On 10/15/14, 3:25 AM

No, it is not posssible because of the convention of Openerp/Odoo, we can only have only one model in tree veiw. There is many way to get date from purches order line.  Add one function field in purchase order  which calculte  value form its purchase Line.  

Don't understand : I have purchase.order.tree purchase.order And I want to add the field "date" of purchase.order.line in this view.

Nanie BE
on 10/15/14, 4:19 AM

Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 10/15/14, 8:01 AM

True, you cannot access child objects field...

However with help of some work around you can acheive it, again depending on your requirement, but keep it mind, you are trying to fetch values of muliple records (One2many) and dumping it in single record's field (parent), hence you can either have first/last of child records value, or concatenation of all child's records values as single value...

So all you need to do is First create a functional field in Purchase Order object, (Note: store is False)

case 1: Assume you are trying to fetch First Child records value, say "description", then evaluate your functional field to fetch only first records' "description" value

case 2: Assume you want to fetch all Child records value, say "description", then evaluate your functional field to fetch all records' "description" value, by concatenating with a comma(,) separator...

Now the same functional field can be used in Purchase Order Tree... And you will have to write a defined search view for it, use _fnct_search..

Hope this helps you, even i had the same requirement, so i acheived it with functional field and defined search view


thanks, can you help me about the method which can fetch the value in the purchase order line to store in the value of purchase order. Thanks

Nanie BE
on 10/16/14, 1:39 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: 10/15/14, 3:14 AM
Seen: 1793 times
Last updated: 3/16/15, 8:10 AM