Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
By default, the mrp.bom module refers each bill of material (bom) to a parent product through the product_id field, which establishes a many2one relation to the product.product model.
Now, I would like to refer to and display fields belonging to the parent product in the view of the bom itself. How is this best achieved?
That's the purpose of related fields. On the bom object, create a related field poiting to the field you wan to display.
Here is in an old example from the doc. The purpose is to display country_id by going through state_id :
'country_id': fields.related( 'state_id', 'country_id', type="many2one", relation="res.country", string="Country", store=False)
You can the use field 'country_id' as usual.
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 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 11/6/14, 6:22 AM|
|Seen: 1202 times|
|Last updated: 3/16/15, 8:10 AM|