Check bank account number for all payments

Since the bank is no more required, we must check on processing that bank
is filled for accounts used.

issue11198
review393581002
This commit is contained in:
Cédric Krier committed 2022-04-11 23:47:49 +02:00
1 parent 29a0d0c352
commit c8e2b36231
2 files changed
+14 -7

No files matched your search

+3
View File
@@ -9,6 +9,9 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.message" id="msg_payment_process_no_iban">
<field name="text">To process payment "%(payment)s" you must define IBAN for it.</field>
</record>
<record model="ir.message" id="msg_payment_process_no_bank">
<field name="text">To process payment "%(payment)s" you must define a bank for the account "%(bank_account)s".</field>
</record>
<record model="ir.message" id="msg_mandate_unique_id">
<field name="text">SEPA mandate identification must be unique by company.</field>
</record>
+11 -7
View File
@@ -229,13 +229,17 @@ class Group(metaclass=PoolMeta):
payment.sepa_mandate = mandate
payment.sepa_mandate_sequence_type = sequence_type
Payment.save(payments)
else:
for payment in self.payments:
if not payment.sepa_bank_account_number:
raise ProcessError(
gettext('account_payment_sepa'
'.msg_payment_process_no_iban',
payment=payment.rec_name))
for payment in self.payments:
if not payment.sepa_bank_account_number:
raise ProcessError(
gettext('account_payment_sepa'
'.msg_payment_process_no_iban',
payment=payment.rec_name))
if not payment.sepa_bank_account_number.account.bank:
raise ProcessError(
gettext('account_payment_sepa'
'.msg_payment_process_no_bank',
payment=payment.rec_name))
to_write = []
for key, payments in self.sepa_payments:
to_write.append(payments)