[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) <mat@odoo.com>
This commit is contained in:
Martin Trigaux
2020-11-02 14:04:48 +00:00
parent c11179b0b4
commit b5ab4a3aca
+2 -6
View File
@@ -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