[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#101571 X-original-commit: 574e797809a83c25b7e3f602f46ec621db1a3294 Signed-off-by: Adrien Widart <awt@odoo.com>
This commit is contained in:
committed by
Adrien Widart
parent
c120f43905
commit
39a348c110
@@ -32,7 +32,7 @@ class AccountMove(models.Model):
|
||||
if self.state == 'draft' or not self.invoice_date or self.move_type not in ('out_invoice', 'out_refund'):
|
||||
return res
|
||||
|
||||
current_invoice_amls = self.invoice_line_ids.filtered(lambda aml: aml.display_type == 'product' and aml.product_id and aml.quantity)
|
||||
current_invoice_amls = self.invoice_line_ids.filtered(lambda aml: aml.display_type == 'product' 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]
|
||||
|
||||
Reference in New Issue
Block a user