From 5e88cab36b97ce1992663b99456d034d7a05303a Mon Sep 17 00:00:00 2001 From: sergio-teruel Date: Thu, 16 Jan 2025 17:43:06 +0100 Subject: [PATCH] [FIX] agreement_rebate: Settlements are excluded if any line has been invoiced before TT52964 --- agreement_rebate/wizards/invoice_create.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/agreement_rebate/wizards/invoice_create.py b/agreement_rebate/wizards/invoice_create.py index fbfe5a4b..0c28cd7e 100644 --- a/agreement_rebate/wizards/invoice_create.py +++ b/agreement_rebate/wizards/invoice_create.py @@ -97,9 +97,11 @@ def action_create_invoice(self): settlements -= settlements.filtered( lambda s: any( ail.move_id.move_type == self.invoice_type - for ail in s.line_ids.mapped("invoice_line_ids").filtered( - lambda ln: ln.parent_state != "cancel" + for ail in s.line_ids.filtered( + lambda st_line: st_line.invoice_status == "to_invoice" ) + .mapped("invoice_line_ids") + .filtered(lambda ln: ln.parent_state != "cancel") ) ) invoices = settlements.with_context(