[FIX] purchase: recompute qty_received_method

qty_received_method is not recomputed if the product type change, and can lead to issues on existing purchases when trying to generate a Vendor Bill.

# HOW TO REPRODUCE:
- Create product P, type: Service, Control Policy: 'On Received Qty'
- Create PO for 1 unit of P (do not confirm)
- Update type of P to Storable
- Confirm PO, Receive Products
=> Qty Received is 0, not able to generate Bill

closes odoo/odoo#122409

X-original-commit: fcc1e8e325e6d9f4782b2f82769e1200b7b9a0c3
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Fesquet David (dafr) <dafr@odoo.com>
This commit is contained in:
David (dafr)
2023-05-26 10:28:57 +02:00
parent a06ffa954a
commit 5bfae344c8
+1 -1
View File
@@ -1075,7 +1075,7 @@ class PurchaseOrderLine(models.Model):
else:
return self.invoice_lines
@api.depends('product_id')
@api.depends('product_id', 'product_id.type')
def _compute_qty_received_method(self):
for line in self:
if line.product_id and line.product_id.type in ['consu', 'service']: