From b5ab4a3acaecd5dcc0792b044f4f13e9ee7f477e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 2 Nov 2020 11:09:15 +0000 Subject: [PATCH] [FIX] sale: revert cfc9abe14689d Revert "[FIX] sale: correct _get_to_invoice_qty depends" This reverts commit cfc9abe14689db82acf1872fa8d358662fc7e123. While the field is indeed in the list of records, it's a big change of behaviour. Retroactively changing the invoicable lines of sale.order that are closed is dangerous and can lead on unexpected behaviours. Performances can also be bad when changing the product configuration on a database with a lot of sale orders. Changing the product configuration should only apply to future orders, not past. closes odoo/odoo#61168 X-original-commit: be13bc94c2ff51b99a4399be44a765d0b28202eb Signed-off-by: Martin Trigaux (mat) --- addons/sale/models/sale.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 6b214c8d960..ceb16a60d48 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1184,12 +1184,8 @@ class SaleOrderLine(models.Model): else: line.product_updatable = True - @api.depends( - 'qty_invoiced', - 'qty_delivered', - 'product_uom_qty', - 'order_id.state', - 'product_id.invoice_policy') + # no trigger product_id.invoice_policy to avoid retroactively changing SO + @api.depends('qty_invoiced', 'qty_delivered', 'product_uom_qty', 'order_id.state') def _get_to_invoice_qty(self): """ Compute the quantity to invoice. If the invoice policy is order, the quantity to invoice is