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
|Asked: 11/6/14, 6:22 AM|
|Seen: 1124 times|
|Last updated: 3/16/15, 8:10 AM|