Add patch for issue9797.

This commit is contained in:
Albert Cervera i Areny 2020-11-06 10:41:23 +01:00
parent ab2efe2395
commit fbbc4b8eb0
2 changed files with 35 additions and 0 deletions

33
issue9797.diff Normal file
View File

@ -0,0 +1,33 @@
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:

2
series
View File

@ -39,3 +39,5 @@ lazy_loading.diff # [trytond] https://discuss.tryton.org/t/should-create-uid-wri
issue9103.diff # [trytond] User-defined reports for custom template extensions
issue9616.diff # [analytic_invoice] Analytic move is not created when closing an asset
issue9797.diff # [account_payment_sepa] Slowness processing sepa