mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
33 lines
1.6 KiB
Diff
33 lines
1.6 KiB
Diff
index ac29d17..2b240c1 100644
|
|
--- a/trytond/trytond/modules/account_payment_sepa/payment.py
|
|
+++ b/trytond/trytond/modules/account_payment_sepa/payment.py
|
|
@@ -190,18 +190,23 @@ class Group(metaclass=PoolMeta):
|
|
Payment = pool.get('account.payment')
|
|
if self.kind == 'receivable':
|
|
mandates = Payment.get_sepa_mandates(self.payments)
|
|
+ sequence_types = {}
|
|
for payment, mandate in zip(self.payments, mandates):
|
|
if not mandate:
|
|
raise ProcessError(
|
|
gettext('account_payment_sepa'
|
|
'.msg_payment_process_no_mandate',
|
|
payment=payment.rec_name))
|
|
- # Write one by one because mandate.sequence_type must be
|
|
- # recomputed each time
|
|
- Payment.write([payment], {
|
|
- 'sepa_mandate': mandate,
|
|
- 'sepa_mandate_sequence_type': mandate.sequence_type,
|
|
- })
|
|
+ sequence_type = sequence_types.get(mandate)
|
|
+ if not sequence_type:
|
|
+ sequence_type = mandate.sequence_type
|
|
+ if sequence_type == 'FRST':
|
|
+ sequence_types[mandate] = 'RCUR'
|
|
+ else:
|
|
+ sequence_types[mandate] = sequence_type
|
|
+ payment.sepa_mandate = mandate
|
|
+ payment.sepa_mandate_sequence_type = sequence_type
|
|
+ Payment.save(self.payments)
|
|
else:
|
|
for payment in self.payments:
|
|
if not payment.sepa_bank_account_number:
|