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

purchase_price in sale.order.line, you can see it in database as column but not in sale.py sale_order_line class definition, why?

By
E.M.
on 2/7/16, 9:20 AM 309 views

I am trying to calculate the value of margin for every sale order line.

I can see that purchase_price is part of database as a regular column in sale_order_line.

But when I read sale.py code I can see that it is not part of sale_order_line class.

I can't either use the value in on_change attributes, everytime I change the value of purchase_price in the form and try to submit it to backend server the previous value is used.

Anyway if I modify and store the value is properly recorded in database. Could someone help me to understand how this works?

Thanks,

Odoo uses module mechanism. So if you don't install purchase, you don't have purchase_price in sale model. So if you want use this field, your module need to depend of purchase ! If you search the declaration, it is in sale_margin. Module sale_margin do what you are looking for ... I think... :)

Jérémy Kersten (jke)
on 2/7/16, 1:27 PM

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: 2/7/16, 9:20 AM
Seen: 309 times
Last updated: 2/7/16, 9:20 AM