This question has been flagged
1 Reply
1913 Views

I am trying to add a custom field "Customer Name" to the model mrp.bom . this "Customer Name" field should also be visible in mrp.production. Is there  a way in odoo to connect those 2 fields .


For clarification let's say I have a product test1 with Customer Name "Amer" set in the BOM  When I choose to manufacture test1 Amer should appear in the Customer Name field of the mrp.production form view.

Avatar
Discard
Best Answer

Hello Aamer,

I think what you are after is a related field, your field would be placed on the BOM as a standard Char:

customer_name_on_bom = fields.Char(string="Customer Name")

On the mrp.production model you would have another Char field but put a "related" parameter as: 

customer_name_on_mrp = fields.Char(string="Customer Name", related="bom_id.customer_name_on_bom")

I hope this helps,

Thanks, 

Avatar
Discard
Author

Thank you so much , This is exactly what I needed.

Thank Jack, In ODDO 15 i am trying to do the same directly in the form. If I have a field in one model (f:i x_AAAA), how to create the related custom field in othe model
Thanks in advance