Move field bank_account_required from module account_payment_partner to account_payment_mode

Make the mandate a required field on payment line when the payment method has mandate_required=True
Make the bank account a required field on payment line when the payment method has bank_account_required=True
Minor code cleanup
PEP8
This commit is contained in:
Alexis de Lattre
2016-06-14 22:25:23 +02:00
committed by Enric Tobella
parent 48a0faac49
commit d6fb1bf115
2 changed files with 3 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
<field name="name">SEPA Direct Debit for customers</field>
<field name="code">sepa_direct_debit</field>
<field name="payment_type">inbound</field>
<field name="bank_account_required" eval="True"/>
<field name="mandate_required" eval="True"/>
<field name="pain_version">pain.008.001.02</field>
</record>

View File

@@ -36,10 +36,10 @@ class AccountPaymentOrder(models.Model):
"""Creates the SEPA Direct Debit file. That's the important code !"""
self.ensure_one()
if (
self.payment_mode_id.payment_method_id.code !=
self.payment_method_id.code !=
'sepa_direct_debit'):
return super(AccountPaymentOrder, self).generate_payment_file()
pain_flavor = self.payment_mode_id.payment_method_id.pain_version
pain_flavor = self.payment_method_id.pain_version
# We use pain_flavor.startswith('pain.008.001.xx')
# to support country-specific extensions such as
# pain.008.001.02.ch.01 (cf l10n_ch_sepa)