Skip to content
Snippets Groups Projects
Commit affc9abb authored by Katherine Zaoral's avatar Katherine Zaoral
Browse files

[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: default avatarAdrien Widart <awt@odoo.com>
parent 3293ffa0
No related branches found
No related tags found
No related merge requests found
......@@ -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]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment