Add support for scheme (CORE or B2B), backported from 8.0

This commit is contained in:
Alexis de Lattre
2015-04-08 16:00:32 +02:00
parent deac3313d1
commit ddbae3e8c1
3 changed files with 21 additions and 3 deletions

View File

@@ -166,10 +166,15 @@ class sdd_mandate(orm.Model):
help="When the field 'Migrated to SEPA' is not active, this "
"field will be used as the Original Mandate Identification in "
"the Direct Debit file."),
'scheme': fields.selection([
('CORE', 'Basic (CORE)'),
('B2B', 'Enterprise (B2B)')
], 'Scheme', required=True)
}
_defaults = {
'sepa_migrated': True,
'scheme': 'CORE',
}
def _check_sdd_mandate(self, cr, uid, ids):

View File

@@ -18,6 +18,7 @@
<xpath expr="//field[@name='partner_id']" position="after">
<field name="type" on_change="mandate_type_change(type)"/>
<field name="recurrent_sequence_type" attrs="{'invisible': [('type', '=', 'oneoff')], 'required': [('type', '=', 'recurrent')]}"/>
<field name="scheme"/>
</xpath>
<xpath expr="//field[@name='partner_bank_id']" position="attributes">
<attribute name="on_change">mandate_partner_bank_change(partner_bank_id, type, recurrent_sequence_type, last_debit_date, state)</attribute>
@@ -37,6 +38,7 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='unique_mandate_reference']" position="after">
<field name="type" string="Type"/>
<field name="scheme"/>
</xpath>
</field>
</record>
@@ -44,10 +46,20 @@
<record id="sdd_mandate_search" model="ir.ui.view">
<field name="name">sdd.mandate.search</field>
<field name="model">account.banking.mandate</field>
<field name="inherit_id" ref="account_banking_mandate.view_mandate_search"/>
<field name="arch" type="xml">
<xpath expr="//filter[@name='expired']" position="after">
<filter name="oneoff" string="One-Off" domain="[('type', '=', 'oneoff')]" />
<filter name="recurrent" string="Recurrent" domain="[('type', '=', 'recurrent')]" />
<group string="Group By" name="groupby">
<filter name="type_groupby" string="Type"
context="{'group_by': 'type'}"/>
<filter name="scheme_groupby" string="Scheme"
context="{'group_by': 'scheme'}"/>
<filter name="recurrent_sequence_type_groupby"
string="Sequence Type"
context="{'group_by': 'recurrent_sequence_type'}"/>
</group>
</xpath>
</field>
</record>

View File

@@ -195,6 +195,7 @@ class banking_export_sdd_wizard(orm.TransientModel):
"line with partner '%s' and Invoice ref '%s'.")
% (line.partner_id.name,
line.ml_inv_ref.number))
scheme = line.mandate_id.scheme
if line.mandate_id.state != 'valid':
raise orm.except_orm(
_('Error:'),
@@ -226,7 +227,7 @@ class banking_export_sdd_wizard(orm.TransientModel):
assert seq_type_label is not False
seq_type = seq_type_map[seq_type_label]
key = (requested_date, priority, seq_type)
key = (requested_date, priority, seq_type, scheme)
if key in lines_per_group:
lines_per_group[key].append(line)
else:
@@ -237,7 +238,7 @@ class banking_export_sdd_wizard(orm.TransientModel):
cr, uid, line.id,
{'date': requested_date}, context=context)
for (requested_date, priority, sequence_type), lines in \
for (requested_date, priority, sequence_type, scheme), lines in \
lines_per_group.items():
# B. Payment info
payment_info_2_0, nb_of_transactions_2_4, control_sum_2_5 = \
@@ -246,7 +247,7 @@ class banking_export_sdd_wizard(orm.TransientModel):
"sepa_export.payment_order_ids[0].reference + '-' + "
"sequence_type + '-' + requested_date.replace('-', '') "
"+ '-' + priority",
priority, 'CORE', sequence_type, requested_date, {
priority, scheme, sequence_type, requested_date, {
'sepa_export': sepa_export,
'sequence_type': sequence_type,
'priority': priority,