From 7f01ea640f9ccdf7e68b6a495a6c7ac6c583e9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20Laukavi=C4=8Dius?= Date: Sat, 24 Oct 2020 11:12:50 +0000 Subject: [PATCH] [FIX] sale: correct _get_to_invoice_qty depends `product_id.invoice_policy` dependency was missing. When changing the policy from "delivery" to "order" of a product, the quantity of invoiceable products was not recomputed and remained 0 Closes odoo/odoo#60674 closes odoo/odoo#61026 X-original-commit: cfc9abe14689db82acf1872fa8d358662fc7e123 Signed-off-by: Martin Trigaux (mat) --- addons/sale/models/sale.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 9ca3bf8a20a..6b214c8d960 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1184,7 +1184,12 @@ class SaleOrderLine(models.Model): else: line.product_updatable = True - @api.depends('qty_invoiced', 'qty_delivered', 'product_uom_qty', 'order_id.state') + @api.depends( + 'qty_invoiced', + 'qty_delivered', + 'product_uom_qty', + 'order_id.state', + 'product_id.invoice_policy') def _get_to_invoice_qty(self): """ Compute the quantity to invoice. If the invoice policy is order, the quantity to invoice is