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.

0

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

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

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

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

2
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
1
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
1

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

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

deep
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

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: 10/15/14, 3:14 AM
Seen: 1030 times
Last updated: 3/16/15, 8:10 AM