diff --git a/recurring_contract/models/move.py b/recurring_contract/models/move.py index f4e1c7a1..bd6d6c8f 100644 --- a/recurring_contract/models/move.py +++ b/recurring_contract/models/move.py @@ -73,7 +73,7 @@ def _get_bank_statement_notes(self): def action_invoice_paid(self): """Call invoice_paid method on related contracts.""" res = super().action_invoice_paid() - for invoice in self: + for invoice in self.filtered(lambda i: i.payment_state == "paid"): contracts = invoice.mapped("invoice_line_ids.contract_id") contracts.invoice_paid(invoice) return res