Thanks for your quick respons!
I'm trying but I'm new to this so probably doing something wrong, what I have:
Fields
x_studio_verkooporderregel_vlookup = new studio field where I'm trying to get the first line
x_studio_type_product = product type, atrribute of the (sale) order line
When x_studio_type_product = 'Zonnepanelen' , it needs to show first record
Dependency:
order.line.product_id.x_studio_type_product
Code:
for rec in self:
line = rec.sale.order.line.filtered(lambda l: l.product_id.x_studio_type_product == 'Zonnepanelen')
if line:
rec['x_studio_verkooporderregel_vlookup'] = line[0].product_id
else:
rec['x_studio_verkooporderregel_vlookup'] = False