From 5bfae344c8cc42f4b75efe1945f545ea99b88c9c Mon Sep 17 00:00:00 2001 From: "David (dafr)" Date: Tue, 25 Apr 2023 10:06:16 +0000 Subject: [PATCH] [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) Signed-off-by: Fesquet David (dafr) --- addons/purchase/models/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index 72f51ff3988..6af4acb8310 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -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']: