i have model purchase.request the user enter product line in line_ids one2many field for this model the user can create purchase order with products inserted in the line_ids in purchase.request model, the user can delete one line from order_lines in purchase,order.
how can i check if the line_ids from purchase.request model is existing in order_line in purchase.order model,
i have 3 model:
purchase.request.line linked with purchase.request using request_id.
and purchase.order linked with purchase.request using request_ids many2many field.
i try this code:
for rec in self:
purchase_orders = self.env['purchase.order'].search([('request_ids', 'in', rec.id)])
for order_line in purchase_orders.order_line:
for line in rec.line_ids:
if line.product_id in order_line:
rec.line_ids.purchase_state = 'rfq'
but i get below error:
TypeError: Mixing apples and oranges: product.product(1549,) in purchase.order.line(1570,)
Thanks .....