From affc9abbcf596e025af0fd33654af3fca709b2ed Mon Sep 17 00:00:00 2001 From: Katherine Zaoral <kz@adhoc.com.ar> Date: Thu, 15 Sep 2022 16:38:33 +0000 Subject: [PATCH] [FIX] sale_stock: Compute lots only when nedeed Only compute the lot values info on stockable or consu (kits) products on the invoice lines closes odoo/odoo#100322 Signed-off-by: Adrien Widart <awt@odoo.com> --- addons/sale_stock/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_stock/models/account_move.py b/addons/sale_stock/models/account_move.py index f4fb8eed3c86..b2ac06090583 100644 --- a/addons/sale_stock/models/account_move.py +++ b/addons/sale_stock/models/account_move.py @@ -29,7 +29,7 @@ class AccountMove(models.Model): if self.state == 'draft' or not self.invoice_date or self.type not in ('out_invoice', 'out_refund'): return [] - current_invoice_amls = self.invoice_line_ids.filtered(lambda aml: not aml.display_type and aml.product_id and aml.quantity) + current_invoice_amls = self.invoice_line_ids.filtered(lambda aml: not aml.display_type and aml.product_id and aml.product_id.type in ('consu', 'product') and aml.quantity) all_invoices_amls = current_invoice_amls.sale_line_ids.invoice_lines.filtered(lambda aml: aml.move_id.state == 'posted').sorted(lambda aml: (aml.date, aml.move_name, aml.id)) index = all_invoices_amls.ids.index(current_invoice_amls[:1].id) if current_invoice_amls[:1] in all_invoices_amls else 0 previous_amls = all_invoices_amls[:index] -- GitLab