details:   https://code.tryton.org/tryton/commit/9225e8791856
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Nov 27 15:14:26 2025 +0100
description:
        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
diffstat:

 modules/account_payment_sepa/payment.py |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r 9fe271765489 -r 9225e8791856 modules/account_payment_sepa/payment.py
--- a/modules/account_payment_sepa/payment.py   Wed Nov 26 21:34:50 2025 +0100
+++ b/modules/account_payment_sepa/payment.py   Thu Nov 27 15:14:26 2025 +0100
@@ -215,7 +215,8 @@
         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:

Reply via email to