diff --git a/account_banking_mandate/models/account_invoice.py b/account_banking_mandate/models/account_invoice.py index 140a78229..d821ee3e2 100644 --- a/account_banking_mandate/models/account_invoice.py +++ b/account_banking_mandate/models/account_invoice.py @@ -59,7 +59,8 @@ class AccountInvoice(models.Model): ('state', '=', 'valid'), ('partner_id', '=', self.commercial_partner_id.id), ]) - self.mandate_id = mandates[0] + if mandates: + self.mandate_id = mandates[0] else: self.mandate_id = False