I have created a custom field in the model mrp.BOM structure as below to compute the total cost of BOM for a product:-
Field Name:- x_bom_total
Field Label:- Total BOM
Field Type:- Float
ReadOnly:- True
Dependency:- bom_line_ids
Dependent Field name 'bom_line_ids' is the field which display all the materials used in the product. It refernces to the model 'mrp.bom.line' in a one2many relationship model. So now in the computation part how to calculate the Total BOM for the product something like this:-
for record in self:
for each_object in record.bom_line_ids:
record['x_bom_total'] += record.bom_line_ids.qty * record.bom_line_ids.list_price
I am using odoo v11. Does anyone have an idea?