sepa_direct_debit_mandate: Split basic and sepa mandate

This commit is contained in:
Sergio Incaser
2016-04-01 15:16:29 +02:00
committed by Enric Tobella
parent 5a7ee68bca
commit b06d52b610
7 changed files with 188 additions and 4 deletions

View File

@@ -27,6 +27,9 @@
'wizard/export_sdd_view.xml',
'data/mandate_expire_cron.xml',
'data/payment_type_sdd.xml',
'data/report_paperformat.xml',
'reports/sepa_direct_debit_mandate.xml',
'views/report_sepa_direct_debit_mandate.xml',
'security/original_mandate_required_security.xml',
],
'demo': ['demo/sepa_direct_debit_demo.xml'],

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="paperformat_euro_sepa_lowmargin" model="report.paperformat">
<field name="name">European A4 low margin for SEPA</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">10</field>
<field name="margin_bottom">10</field>
<field name="margin_left">5</field>
<field name="margin_right">5</field>
<field name="header_line" eval="False" />
<field name="header_spacing">0</field>
<field name="dpi">80</field>
</record>
</data>
</openerp>

View File

@@ -19,6 +19,7 @@
<record id="res_partner_12_mandate" model="account.banking.mandate">
<field name="partner_bank_id" ref="account_banking_payment_export.res_partner_12_iban"/>
<field name="format">sepa</field>
<field name="type">recurrent</field>
<field name="recurrent_sequence_type">first</field>
<field name="signature_date">2014-02-01</field>
@@ -27,6 +28,7 @@
<record id="res_partner_2_mandate" model="account.banking.mandate">
<field name="partner_bank_id" ref="account_banking_payment_export.res_partner_2_iban"/>
<field name="format">sepa</field>
<field name="type">recurrent</field>
<field name="recurrent_sequence_type">first</field>
<field name="signature_date" eval="time.strftime('%Y-%m-01')" />

View File

@@ -31,6 +31,10 @@ class AccountBankingMandate(models.Model):
}
}
format = fields.Selection(
selection_add=[('sepa', _('Sepa Mandate'))],
default='sepa',
)
type = fields.Selection([('recurrent', 'Recurrent'),
('oneoff', 'One-Off')],
string='Type of Mandate', required=True,
@@ -91,6 +95,18 @@ class AccountBankingMandate(models.Model):
"recurrent mandate '%s' which is not marked as 'Migrated to "
"SEPA'.") % self.unique_mandate_reference)
@api.model
def _get_mandate_format(self):
res = super(AccountBankingMandate, self)._get_mandate_format()
res.append(('sepa', _('Sepa Mandate')))
return res
@api.model
def _default_mandate_format(self):
res = super(AccountBankingMandate, self).default_mandate_format()
return 'sepa'
@api.one
@api.onchange('partner_bank_id')
def mandate_partner_bank_change(self):

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- QWeb Report -->
<report
id="report_sepa_direct_debit_mandate"
model="account.banking.mandate"
string="Sepa Mandate"
report_type="qweb-pdf"
name="account_banking_sepa_direct_debit.sepa_direct_debit_mandate"
file="account_banking_sepa_direct_debit.sepa_direct_debit_mandate"
/>
<record id="report_sepa_direct_debit_mandate" model="ir.actions.report.xml">
<field name="paperformat_id"
ref="account_banking_sepa_direct_debit.paperformat_euro_sepa_lowmargin"/>
</record>
</data>
</openerp>

View File

@@ -17,9 +17,10 @@
<field name="inherit_id" ref="account_banking_mandate.view_mandate_form"/>
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="type"/>
<field name="recurrent_sequence_type" attrs="{'invisible': [('type', '=', 'oneoff')], 'required': [('type', '=', 'recurrent')]}"/>
<field name="scheme"/>
<field name="type" attrs="{'invisible': [('format', '!=', 'sepa')]}"/>
<field name="recurrent_sequence_type"
attrs="{'invisible': ['|', ('type', '=', 'oneoff'), ('format', '!=', 'sepa')], 'required': [('type', '=', 'recurrent')]}"/>
<field name="scheme" attrs="{'invisible': [('format', '!=', 'sepa')]}"/>
</field>
<field name="last_debit_date" position="after">
<field name="sepa_migrated" groups="account_banking_sepa_direct_debit.group_original_mandate_required"/>
@@ -124,6 +125,5 @@
<field name="description">Sequence Type set to Final</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="sepa_direct_debit_mandate_document">
<div class="page">
<style type="text/css">
.under-line{
border-bottom:1px solid;
}
input{
vertical-align: baseline;
}
.panel-default{
border:2px solid;
}
</style>
<div class="row mt0">
<div class="col-xs-3">
<img t-if="o.company_id.logo" t-att-src="'data:image/png;base64,%s' % o.company_id.logo" style="max-height: 45px;"/>
</div>
<div class="col-xs-12 text-center">
<h4 t-if="o.scheme != 'B2B'"><strong>Sepa Direct Debit Mandate</strong></h4>
<h4 t-if="o.scheme == 'B2B'"><strong>Sepa Business-To-Business Direct debit Mandate</strong></h4>
</div>
</div>
<div class="row mt8">
<div class="col-xs-12">
<div class="panel panel-default">
<span class="col-xs-12 text-right" style="font-size:10px;">To be completed by the creditor</span>
<div class="panel-body mb8">
<div class="col-xs-12"><em>Mandate Reference:</em></div><div class="col-xs-10 col-xs-offset-2 under-line mt4"><span t-field="o.unique_mandate_reference"/></div>
<div class="col-xs-12"><em>Identifier:</em></div><div class="col-xs-10 col-xs-offset-2 under-line mt4"><span t-field="o.company_id.sepa_creditor_identifier"/></div>
<div class="col-xs-12"><em>Creditor's Name:</em></div><div class="col-xs-10 col-xs-offset-2 under-line mt4"><span t-field="o.company_id.partner_id.name"/></div>
<div class="col-xs-12"><em>Address:</em></div><div class="col-xs-10 col-xs-offset-2 under-line mt4"><span t-field="o.company_id.partner_id.street"/></div>
<div class="col-xs-12"><em>Postal Code - City - Town:</em></div>
<div class="col-xs-10 col-xs-offset-2 under-line mt8">
<span t-field="o.company_id.partner_id.zip"/> -
<span t-field="o.company_id.partner_id.city"/> -
<span t-field="o.company_id.partner_id.state_id"/>
</div>
<div class="col-xs-12"><em>Country:</em></div><div class="col-xs-10 col-xs-offset-2 under-line mt4"><span t-field="o.company_id.partner_id.country_id"/></div>
</div>
</div>
</div>
</div>
<div class="row mt0" style="font-size:12px;">
<div class="col-xs-12">
<p>By signing this mandate form, you authorise (A) <strong><span t-field="o.company_id.name"/></strong>
to send instructions to your bank to debit your account and (B) your bank to
debit your account in accordance with the instructions from <strong><span t-field="o.company_id.name"/></strong>.
</p>
</div>
</div>
<div class="row" style="font-size:12px;">
<div class="col-xs-12">
<p t-if="o.scheme == 'B2B'">
This mandate is only intended for business-to-business transactions.
You are not entitled to a refund from your bank after your account has
been debited, but you are entitled to request your bank
not to debit your account up until the day on which the payment is due.
</p>
<p t-if="o.scheme != 'B2B'">
As part of your rights, you are entitled to a refund from
your bank under the terms and conditions of your agreement
with your bank.
A refund must be claimed within 8 weeks starting from the date on which your account was debited.
</p>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="panel panel-default">
<span class="col-xs-12 text-right" style="font-size:10px;">To be completed by the debtor</span>
<div class="panel-body">
<div class="col-xs-12"><em>Debtor's Name:</em></div><div class="col-xs-10 col-xs-offset-2 under-line mt4"><span t-field="o.partner_id"/></div>
<div class="col-xs-12"><em>Address of the Debtor:</em></div><div class="col-xs-10 col-xs-offset-2 under-line mt4"><span t-field="o.partner_id.street"/></div>
<div class="col-xs-12"><em>Postal Code - City - Town:</em></div>
<div class="col-xs-10 col-xs-offset-2 under-line mt4">
<span t-field="o.partner_id.zip"/> -
<span t-field="o.partner_id.city"/> -
<span t-field="o.partner_id.state_id"/>
</div>
<div class="col-xs-12"><em>Country of the debtor:</em></div><div class="col-xs-10 col-xs-offset-2 under-line mt4"><span t-field="o.partner_id.country_id"/></div>
<div class="col-xs-12"><em>Swift BIC (up to 8 or 11 characteres):</em></div><div class="col-xs-10 col-xs-offset-2 under-line mt4"><span t-field="o.partner_bank_id.bank_bic"/></div>
<div class="col-xs-12"><em>Account Number - IBAN:</em></div><div class="col-xs-10 col-xs-offset-2 under-line mt4"><span t-field="o.partner_bank_id.acc_number"/></div>
<div class="col-xs-12"><em>Type of payment:</em></div>
<div class="col-xs-10 col-xs-offset-2 mt4">
<input type="checkbox" t-att-checked="o.type=='recurrent' or None"> Recurrent</input>
<input type="checkbox" t-att-checked="o.type=='oneoff' or None"> One-Off</input>
</div>
<div class="col-xs-12"><em>Date - Location:</em></div>
<div class="col-xs-10 col-xs-offset-2 under-line mt16"/>
<div class="col-xs-12"><em>Signature of the debtor:</em></div>
<div class="col-xs-10 col-xs-offset-2 under-line mt16"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 text-center" style="font-size:10px;">
<p t-if="o.scheme != 'B2B'">ALL GAPS ARE MANDATORY. ONCE THIS MANDATE HAS BEEN SIGNED MUST BE SENT TO CREDITOR FOR STORAGE.</p>
<p t-if="o.scheme == 'B2B'">ALL GAPS ARE MANDATORY. ONCE THIS MANDATE HAS BEEN SIGNED MUST BE SENT TO CREDITOR FOR STORAGE.
NEVERTHELESS, THE BANK OF DEBTOR REQUIRES DEBTORS AUTHORIZATION BEFORE DEBITING B2B DIRECT DEBITS IN THE ACCOUNT.
THE DEBTOR WILL BE ABLE TO MANAGE THE MENTIONED AUTHORIZATION THROUGH THE MEANS PROVIDED BY HIS BANK.</p>
</div>
</div>
</div>
</template>
<template id="sepa_direct_debit_mandate">
<t t-call="report.html_container">
<t t-foreach="doc_ids" t-as="doc_id">
<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'account_banking_sepa_direct_debit.sepa_direct_debit_mandate_document')"/>
</t>
</t>
</template>
</data>
</openerp>