diff --git a/CHANGELOG b/CHANGELOG
index 18cc18b9bf..603dc8120b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,2 +1,4 @@
+* Add Direct Debit Business to Business scheme
+
Version 3.2.0 - 2014-04-21
-* Initial release
\ No newline at end of file
+* Initial release
diff --git a/doc/index.rst b/doc/index.rst
index 4f143d5f12..2f46a33ee0 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -40,6 +40,9 @@ The Mandate stores information for the Direct Debit. It is mainly defined by:
- Type:
- Recurrent
- One-off
+- Scheme:
+ - CORE
+ - Business to Business
- Signature Date
The mandate can be in one of this states:
diff --git a/payment.py b/payment.py
index 2c1629d319..1862082827 100644
--- a/payment.py
+++ b/payment.py
@@ -154,6 +154,7 @@ class Group:
key = (('date', payment.date),)
if self.kind == 'receivable':
key += (('sequence_type', payment.sepa_mandate.sequence_type),)
+ key += (('scheme', payment.sepa_mandate.scheme),)
return key
def sepa_group_payment_id(self, key):
@@ -256,6 +257,10 @@ class Mandate(Workflow, ModelSQL, ModelView):
'readonly': Eval('state').in_(['validated', 'canceled']),
},
depends=['state'])
+ scheme = fields.Selection([
+ ('CORE', 'Core'),
+ ('B2B', 'Business to Business'),
+ ], 'Scheme', required=True)
signature_date = fields.Date('Signature Date',
states={
'readonly': Eval('state').in_(['validated', 'canceled']),
@@ -310,6 +315,10 @@ class Mandate(Workflow, ModelSQL, ModelView):
def default_type():
return 'recurrent'
+ @staticmethod
+ def default_scheme():
+ return 'CORE'
+
@staticmethod
def default_state():
return 'draft'
diff --git a/template/pain.008.001.02.xml b/template/pain.008.001.02.xml
index d7a4fea5d2..0c57028429 100644
--- a/template/pain.008.001.02.xml
+++ b/template/pain.008.001.02.xml
@@ -53,7 +53,7 @@ this repository contains the full copyright notices and license terms. -->
- CORE
+ ${key['scheme']}
${key['sequence_type']}
diff --git a/template/pain.008.001.04.xml b/template/pain.008.001.04.xml
index 3d18e10876..2d70f65761 100644
--- a/template/pain.008.001.04.xml
+++ b/template/pain.008.001.04.xml
@@ -34,7 +34,7 @@ this repository contains the full copyright notices and license terms. -->
- CORE
+ ${key['scheme']}
${key['sequence_type']}
diff --git a/view/mandate_form.xml b/view/mandate_form.xml
index b71ce56f21..70686d6677 100644
--- a/view/mandate_form.xml
+++ b/view/mandate_form.xml
@@ -11,10 +11,12 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
+
+