From 9cce9ef35eeab910ed09df8b198c59074f6ca68f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 27 Nov 2025 15:14:26 +0100 Subject: [PATCH] Lock only FRST SEPA mandates when processing payment group This prevents most of the time to consume a sequence number for the group because the transaction has to restart to lock the mandates. Closes #14397 --- modules/account_payment_sepa/payment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/account_payment_sepa/payment.py b/modules/account_payment_sepa/payment.py index f45e324914..b86e00cde3 100644 --- a/modules/account_payment_sepa/payment.py +++ b/modules/account_payment_sepa/payment.py @@ -215,7 +215,8 @@ class Group(metaclass=PoolMeta): if self.kind == 'receivable': payments = sorted(self.payments, key=attrgetter('date', 'id')) mandates = Payment.get_sepa_mandates(payments) - Mandate.lock(list(filter(None, mandates))) + Mandate.lock( + [m for m in mandates if m and m.sequence_type == 'FRST']) sequence_types = {} for payment, mandate in zip(payments, mandates): if not mandate: