From e15c53bfdd8f0db40bd36e83431d780e7c349c21 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 23 Sep 2016 18:20:40 +0200 Subject: [PATCH] Update to EPC Rulebook v9.2 that start to apply on 2016-11-20 (bug #300) Remove old fields that were only usefull during SEPA migration in 2014. --- .../__openerp__.py | 1 - .../models/account_banking_mandate.py | 39 --------- .../models/payment_mode.py | 4 - .../models/res_company.py | 2 - .../original_mandate_required_security.xml | 17 ---- .../views/account_banking_mandate_view.xml | 4 - .../views/payment_mode_view.xml | 2 - .../views/res_company_view.xml | 1 - .../wizard/export_sdd.py | 86 ++++--------------- 9 files changed, 19 insertions(+), 137 deletions(-) delete mode 100644 account_banking_sepa_direct_debit/security/original_mandate_required_security.xml diff --git a/account_banking_sepa_direct_debit/__openerp__.py b/account_banking_sepa_direct_debit/__openerp__.py index 798db0176..92a348e05 100644 --- a/account_banking_sepa_direct_debit/__openerp__.py +++ b/account_banking_sepa_direct_debit/__openerp__.py @@ -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, diff --git a/account_banking_sepa_direct_debit/models/account_banking_mandate.py b/account_banking_sepa_direct_debit/models/account_banking_mandate.py index ca2381204..8895a9ba1 100644 --- a/account_banking_sepa_direct_debit/models/account_banking_mandate.py +++ b/account_banking_sepa_direct_debit/models/account_banking_mandate.py @@ -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): diff --git a/account_banking_sepa_direct_debit/models/payment_mode.py b/account_banking_sepa_direct_debit/models/payment_mode.py index f3c1ac1b6..ecfc73f7e 100644 --- a/account_banking_sepa_direct_debit/models/payment_mode.py +++ b/account_banking_sepa_direct_debit/models/payment_mode.py @@ -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() diff --git a/account_banking_sepa_direct_debit/models/res_company.py b/account_banking_sepa_direct_debit/models/res_company.py index c57dc8b04..cd837255e 100644 --- a/account_banking_sepa_direct_debit/models/res_company.py +++ b/account_banking_sepa_direct_debit/models/res_company.py @@ -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') diff --git a/account_banking_sepa_direct_debit/security/original_mandate_required_security.xml b/account_banking_sepa_direct_debit/security/original_mandate_required_security.xml deleted file mode 100644 index e6a8570cf..000000000 --- a/account_banking_sepa_direct_debit/security/original_mandate_required_security.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Original Mandate Required (SEPA) - - - - - diff --git a/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml b/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml index 667cedb54..f23a4e151 100644 --- a/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml +++ b/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml @@ -25,10 +25,6 @@ - - - - diff --git a/account_banking_sepa_direct_debit/views/payment_mode_view.xml b/account_banking_sepa_direct_debit/views/payment_mode_view.xml index 9bba891d6..68703a217 100644 --- a/account_banking_sepa_direct_debit/views/payment_mode_view.xml +++ b/account_banking_sepa_direct_debit/views/payment_mode_view.xml @@ -13,8 +13,6 @@ - diff --git a/account_banking_sepa_direct_debit/views/res_company_view.xml b/account_banking_sepa_direct_debit/views/res_company_view.xml index e4c9e0b93..3c1d3cdcf 100644 --- a/account_banking_sepa_direct_debit/views/res_company_view.xml +++ b/account_banking_sepa_direct_debit/views/res_company_view.xml @@ -14,7 +14,6 @@ - diff --git a/account_banking_sepa_direct_debit/wizard/export_sdd.py b/account_banking_sepa_direct_debit/wizard/export_sdd.py index 9b4022d46..fc898f27e 100644 --- a/account_banking_sepa_direct_debit/wizard/export_sdd.py +++ b/account_banking_sepa_direct_debit/wizard/export_sdd.py @@ -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