Hi,
I want to add a field with Odoo Studio that shows one specific field of one specific line? In this case I have a sale order, which has multiple order lines, where I want to show the first product which has a specific product category.
Example:
I have a sale order with 5 order lines (5 different products)
One (or more) of those order lines has a product with the category "Omvormers". The product name = "Omvormer XYZ"
How can I create a field on the sale order showing the (first) product where category = "Omvormers"? Result should show: Omvormer XYZ
I asked this question before and tried but still not answer working, what i have now:
Dependency: order_line.product_id.categ_id
Code: for rec in self:line = rec.order_line.filtered(lambda l: l.product_id.categ_id == 'Omvormers')
if line:
rec['x_studio_type_omvormer_1'] = line[0].product_id
else:
rec['x_studio_type_omvormer_1'] = False
What am I doing wrong?