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
This commit is contained in:
Cédric Krier
2025-11-27 15:14:26 +01:00
parent c5d64cf98f
commit 9cce9ef35e
+2 -1
View File
@@ -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: