mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Merge pull request #303 from akretion/8-sepa-20161120-new-rules
8 .0 Update to new SEPA rules that start on 2016-11-20
This commit is contained in:
@@ -30,7 +30,6 @@
|
||||
'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'],
|
||||
'installable': True,
|
||||
|
||||
@@ -46,21 +46,6 @@ class AccountBankingMandate(models.Model):
|
||||
string='Sequence Type for Next Debit', track_visibility='onchange',
|
||||
help="This field is only used for Recurrent mandates, not for "
|
||||
"One-Off mandates.", default="first")
|
||||
sepa_migrated = fields.Boolean(
|
||||
string='Migrated to SEPA', track_visibility='onchange',
|
||||
help="If this field is not active, the mandate section of the next "
|
||||
"direct debit file that include this mandate will contain the "
|
||||
"'Original Mandate Identification' and the 'Original Creditor "
|
||||
"Scheme Identification'. This is required in a few countries "
|
||||
"(Belgium for instance), but not in all countries. If this is "
|
||||
"not required in your country, you should keep this field always "
|
||||
"active.", default=True)
|
||||
original_mandate_identification = fields.Char(
|
||||
string='Original Mandate Identification', track_visibility='onchange',
|
||||
size=35,
|
||||
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)')],
|
||||
string='Scheme', default="CORE")
|
||||
@@ -76,30 +61,6 @@ class AccountBankingMandate(models.Model):
|
||||
_("The recurrent mandate '%s' must have a sequence type.")
|
||||
% mandate.unique_mandate_reference)
|
||||
|
||||
@api.multi
|
||||
@api.constrains('type', 'recurrent_sequence_type', 'sepa_migrated')
|
||||
def _check_migrated_to_sepa(self):
|
||||
for mandate in self:
|
||||
if (mandate.type == 'recurrent' and not mandate.sepa_migrated and
|
||||
mandate.recurrent_sequence_type != 'first'):
|
||||
raise exceptions.Warning(
|
||||
_("The recurrent mandate '%s' which is not marked as "
|
||||
"'Migrated to SEPA' must have its recurrent sequence "
|
||||
"type set to 'First'.")
|
||||
% mandate.unique_mandate_reference)
|
||||
|
||||
@api.multi
|
||||
@api.constrains('type', 'original_mandate_identification', 'sepa_migrated')
|
||||
def _check_original_mandate_identification(self):
|
||||
for mandate in self:
|
||||
if (mandate.type == 'recurrent' and not mandate.sepa_migrated and
|
||||
not mandate.original_mandate_identification):
|
||||
raise exceptions.Warning(
|
||||
_("You must set the 'Original Mandate Identification' on "
|
||||
"the recurrent mandate '%s' which is not marked as "
|
||||
"'Migrated to SEPA'.")
|
||||
% mandate.unique_mandate_reference)
|
||||
|
||||
@api.multi
|
||||
@api.onchange('partner_bank_id')
|
||||
def mandate_partner_bank_change(self):
|
||||
|
||||
@@ -19,10 +19,6 @@ class PaymentMode(models.Model):
|
||||
"- a 2-digits checkum\n"
|
||||
"- a 3-letters business code\n"
|
||||
"- a country-specific identifier")
|
||||
original_creditor_identifier = fields.Char(
|
||||
string='Original Creditor Identifier', size=70,
|
||||
help="If not defined, Original Creditor Identifier from company "
|
||||
"will be used.")
|
||||
|
||||
def _sepa_type_get(self):
|
||||
res = super(PaymentMode, self)._sepa_type_get()
|
||||
|
||||
@@ -18,8 +18,6 @@ class ResCompany(models.Model):
|
||||
"of :\n- your country ISO code (2 letters)\n- a 2-digits "
|
||||
"checkum\n- a 3-letters business code\n- a country-specific "
|
||||
"identifier")
|
||||
original_creditor_identifier = fields.Char(
|
||||
string='Original Creditor Identifier', size=70)
|
||||
|
||||
@api.multi
|
||||
@api.constrains('sepa_creditor_identifier')
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2013 Akretion (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
-->
|
||||
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="group_original_mandate_required" model="res.groups">
|
||||
<field name="name">Original Mandate Required (SEPA)</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -25,10 +25,6 @@
|
||||
<field name="scheme" attrs="{'invisible': [('format', '!=', 'sepa')],
|
||||
'required': [('format', '=', 'sepa')]}"/>
|
||||
</field>
|
||||
<field name="last_debit_date" position="after">
|
||||
<field name="sepa_migrated" groups="account_banking_sepa_direct_debit.group_original_mandate_required"/>
|
||||
<field name="original_mandate_identification" attrs="{'invisible': [('sepa_migrated', '=', True)], 'required': [('sepa_migrated', '=', False)]}" groups="account_banking_sepa_direct_debit.group_original_mandate_required"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
<group>
|
||||
<field name="sepa_creditor_identifier"
|
||||
attrs="{'invisible': [('sepa_type', '!=', 'sepa_direct_debit')]}"/>
|
||||
<field name="original_creditor_identifier"
|
||||
attrs="{'invisible': [('sepa_type', '!=', 'sepa_direct_debit')]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
<field name="arch" type="xml">
|
||||
<group name="pain" position="inside">
|
||||
<field name="sepa_creditor_identifier"/>
|
||||
<field name="original_creditor_identifier" groups="account_banking_sepa_direct_debit.group_original_mandate_required"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -267,72 +267,25 @@ class BankingExportSddWizard(models.TransientModel):
|
||||
'Mandate Signature Date',
|
||||
'line.mandate_id.signature_date',
|
||||
{'line': line}, 10, gen_args=gen_args)
|
||||
if sequence_type == 'FRST' and (
|
||||
line.mandate_id.last_debit_date or
|
||||
not line.mandate_id.sepa_migrated):
|
||||
previous_bank = self._get_previous_bank(line)
|
||||
if previous_bank or not line.mandate_id.sepa_migrated:
|
||||
amendment_indicator_2_50 = etree.SubElement(
|
||||
mandate_related_info_2_47, 'AmdmntInd')
|
||||
amendment_indicator_2_50.text = 'true'
|
||||
amendment_info_details_2_51 = etree.SubElement(
|
||||
mandate_related_info_2_47, 'AmdmntInfDtls')
|
||||
if previous_bank:
|
||||
if (previous_bank.bank.bic or
|
||||
previous_bank.bank_bic) == \
|
||||
(line.bank_id.bank.bic or
|
||||
line.bank_id.bank_bic):
|
||||
ori_debtor_account_2_57 = etree.SubElement(
|
||||
amendment_info_details_2_51, 'OrgnlDbtrAcct')
|
||||
ori_debtor_account_id = etree.SubElement(
|
||||
ori_debtor_account_2_57, 'Id')
|
||||
ori_debtor_account_iban = etree.SubElement(
|
||||
ori_debtor_account_id, 'IBAN')
|
||||
ori_debtor_account_iban.text = self._validate_iban(
|
||||
self._prepare_field(
|
||||
'Original Debtor Account',
|
||||
'previous_bank.acc_number',
|
||||
{'previous_bank': previous_bank},
|
||||
gen_args=gen_args))
|
||||
else:
|
||||
ori_debtor_agent_2_58 = etree.SubElement(
|
||||
amendment_info_details_2_51, 'OrgnlDbtrAgt')
|
||||
ori_debtor_agent_institution = etree.SubElement(
|
||||
ori_debtor_agent_2_58, 'FinInstnId')
|
||||
ori_debtor_agent_bic = etree.SubElement(
|
||||
ori_debtor_agent_institution, bic_xml_tag)
|
||||
ori_debtor_agent_bic.text = self._prepare_field(
|
||||
'Original Debtor Agent',
|
||||
'previous_bank.bank.bic or '
|
||||
'previous_bank.bank_bic',
|
||||
{'previous_bank': previous_bank},
|
||||
gen_args=gen_args)
|
||||
ori_debtor_agent_other = etree.SubElement(
|
||||
ori_debtor_agent_institution, 'Othr')
|
||||
ori_debtor_agent_other_id = etree.SubElement(
|
||||
ori_debtor_agent_other, 'Id')
|
||||
ori_debtor_agent_other_id.text = 'SMNDA'
|
||||
# SMNDA = Same Mandate New Debtor Agent
|
||||
elif not line.mandate_id.sepa_migrated:
|
||||
ori_mandate_identification_2_52 = etree.SubElement(
|
||||
amendment_info_details_2_51, 'OrgnlMndtId')
|
||||
ori_mandate_identification_2_52.text = \
|
||||
self._prepare_field(
|
||||
'Original Mandate Identification',
|
||||
'line.mandate_id.'
|
||||
'original_mandate_identification',
|
||||
{'line': line},
|
||||
gen_args=gen_args)
|
||||
ori_creditor_scheme_id_2_53 = etree.SubElement(
|
||||
amendment_info_details_2_51, 'OrgnlCdtrSchmeId')
|
||||
self.generate_creditor_scheme_identification(
|
||||
ori_creditor_scheme_id_2_53,
|
||||
'self.payment_order_ids[0].mode.'
|
||||
'original_creditor_identifier or '
|
||||
'self.payment_order_ids[0].company_id.'
|
||||
'original_creditor_identifier',
|
||||
'Original Creditor Identifier',
|
||||
{'self': self}, 'SEPA', gen_args)
|
||||
if sequence_type == 'FRST' and line.mandate_id.last_debit_date:
|
||||
amendment_indicator_2_50 = etree.SubElement(
|
||||
mandate_related_info_2_47, 'AmdmntInd')
|
||||
amendment_indicator_2_50.text = 'true'
|
||||
amendment_info_details_2_51 = etree.SubElement(
|
||||
mandate_related_info_2_47, 'AmdmntInfDtls')
|
||||
ori_debtor_account_2_57 = etree.SubElement(
|
||||
amendment_info_details_2_51, 'OrgnlDbtrAcct')
|
||||
ori_debtor_account_id = etree.SubElement(
|
||||
ori_debtor_account_2_57, 'Id')
|
||||
ori_debtor_agent_other = etree.SubElement(
|
||||
ori_debtor_account_id, 'Othr')
|
||||
ori_debtor_agent_other_id = etree.SubElement(
|
||||
ori_debtor_agent_other, 'Id')
|
||||
ori_debtor_agent_other_id.text = 'SMNDA'
|
||||
# Until 20/11/2016, SMNDA meant
|
||||
# "Same Mandate New Debtor Agent"
|
||||
# After 20/11/2016, SMNDA means
|
||||
# "Same Mandate New Debtor Account"
|
||||
|
||||
self.generate_party_block(
|
||||
dd_transaction_info_2_28, 'Dbtr', 'C',
|
||||
@@ -389,6 +342,5 @@ class BankingExportSddWizard(models.TransientModel):
|
||||
to_expire_mandates.write({'state': 'expired'})
|
||||
first_mandates.write({
|
||||
'recurrent_sequence_type': 'recurring',
|
||||
'sepa_migrated': True,
|
||||
})
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user