Allow to always use RCUR

In November 2016, a simplified usage of sequence type will be effective:
http://www.europeanpaymentscouncil.eu/index.cfm/sepa-direct-debit/2016-sdd-rulebooks/

issue5931
review30591002
This commit is contained in:
Cédric Krier
2016-10-11 18:14:27 +02:00
parent 0f9c75c34f
commit 0a88d87c4f
4 changed files with 22 additions and 2 deletions
+2
View File
@@ -1,3 +1,5 @@
* Allow to always use RCUR
Version 4.0.0 - 2016-05-02
* Bug fixes (see mercurial logs for details)
* Add Python3 support
+11 -1
View File
@@ -368,6 +368,12 @@ class Mandate(Workflow, ModelSQL, ModelView):
'readonly': Eval('state').in_(['validated', 'canceled']),
},
depends=['state'])
sequence_type_rcur = fields.Boolean(
"Always use RCUR",
states={
'invisible': Eval('type') == 'one-off',
},
depends=['type'])
scheme = fields.Selection([
('CORE', 'Core'),
('B2B', 'Business to Business'),
@@ -437,6 +443,10 @@ class Mandate(Workflow, ModelSQL, ModelView):
def default_type():
return 'recurrent'
@classmethod
def default_sequence_type_rcur(cls):
return False
@staticmethod
def default_scheme():
return 'CORE'
@@ -510,7 +520,7 @@ class Mandate(Workflow, ModelSQL, ModelView):
def sequence_type(self):
if self.type == 'one-off':
return 'OOFF'
elif (not self.payments
elif not self.sequence_type_rcur and (not self.payments
or all(not p.sepa_mandate_sequence_type for p in self.payments)
or all(p.rejected for p in self.payments)):
return 'FRST'
+7 -1
View File
@@ -78,6 +78,7 @@ def setup_mandate(company, customer, account):
'account_number': account.numbers[0],
'identification': 'MANDATE',
'type': 'recurrent',
'sequence_type_rcur': False,
'signature_date': Date.today(),
'state': 'validated',
}])[0]
@@ -291,10 +292,15 @@ class AccountPaymentSepaTestCase(ModuleTestCase):
with set_company(company):
company_account, customer_account = setup_accounts(
bank, company, customer)
setup_mandate(company, customer, customer_account)
mandate = setup_mandate(company, customer, customer_account)
journal = setup_journal('pain.008.001.02', 'receivable',
company, company_account)
self.assertEqual(mandate.sequence_type, 'FRST')
mandate.sequence_type_rcur = True
self.assertEqual(mandate.sequence_type, 'RCUR')
mandate.sequence_type_rcur = False
payment, = Payment.create([{
'company': company,
'party': customer,
+2
View File
@@ -15,6 +15,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="signature_date"/>
<label name="type"/>
<field name="type"/>
<label name="sequence_type_rcur"/>
<field name="sequence_type_rcur"/>
<label name="scheme"/>
<field name="scheme"/>
<newline/>