From 5aad4bf427d132b757cc146aaeb3216e8e4b84aa Mon Sep 17 00:00:00 2001 From: andreparames Date: Tue, 3 Jul 2018 11:38:54 +0100 Subject: [PATCH] [ADD] sepa: support Initiating Party Scheme --- account_banking_pain_base/models/account_payment_mode.py | 6 ++++++ .../models/account_payment_order.py | 9 +++++++++ account_banking_pain_base/models/res_company.py | 4 ++++ account_banking_pain_base/models/res_config_settings.py | 2 ++ account_banking_pain_base/views/account_payment_mode.xml | 1 + 5 files changed, 22 insertions(+) diff --git a/account_banking_pain_base/models/account_payment_mode.py b/account_banking_pain_base/models/account_payment_mode.py index 431ebc490..6797b4704 100644 --- a/account_banking_pain_base/models/account_payment_mode.py +++ b/account_banking_pain_base/models/account_payment_mode.py @@ -27,3 +27,9 @@ class AccountPaymentMode(models.Model): "- Country code (2, optional)\n" "- Company idenfier (N, VAT)\n" "- Service suffix (N, issued by bank)") + initiating_party_scheme = fields.Char( + string='Initiating Party Scheme', size=35, + help="This will be used as the 'Initiating Party Scheme Name' in " + "the PAIN files generated by Odoo. This value is determined by the " + "financial institution that will process the file. If not defined, " + "no scheme will be used.\n") diff --git a/account_banking_pain_base/models/account_payment_order.py b/account_banking_pain_base/models/account_payment_order.py index 21e6f81f4..482492cfa 100644 --- a/account_banking_pain_base/models/account_payment_order.py +++ b/account_banking_pain_base/models/account_payment_order.py @@ -284,6 +284,9 @@ class AccountPaymentOrder(models.Model): initiating_party_issuer = ( self.payment_mode_id.initiating_party_issuer or self.payment_mode_id.company_id.initiating_party_issuer) + initiating_party_scheme = ( + self.payment_mode_id.initiating_party_scheme or + self.payment_mode_id.company_id.initiating_party_scheme) # in pain.008.001.02.ch.01.xsd files they use # initiating_party_identifier but not initiating_party_issuer if initiating_party_identifier: @@ -292,6 +295,12 @@ class AccountPaymentOrder(models.Model): iniparty_org_other = etree.SubElement(iniparty_org_id, 'Othr') iniparty_org_other_id = etree.SubElement(iniparty_org_other, 'Id') iniparty_org_other_id.text = initiating_party_identifier + if initiating_party_scheme: + iniparty_org_other_scheme = etree.SubElement( + iniparty_org_other, 'SchmeNm') + iniparty_org_other_scheme_name = etree.SubElement( + iniparty_org_other_scheme, 'Prtry') + iniparty_org_other_scheme_name.text = initiating_party_scheme if initiating_party_issuer: iniparty_org_other_issuer = etree.SubElement( iniparty_org_other, 'Issr') diff --git a/account_banking_pain_base/models/res_company.py b/account_banking_pain_base/models/res_company.py index 127d8e179..c2711a0a3 100644 --- a/account_banking_pain_base/models/res_company.py +++ b/account_banking_pain_base/models/res_company.py @@ -20,6 +20,10 @@ class ResCompany(models.Model): string='Initiating Party Identifier', size=35, help="This will be used as the 'Initiating Party Identifier' in " "the PAIN files generated by Odoo.") + initiating_party_scheme = fields.Char( + string='Initiating Party Scheme', size=35, + help="This will be used as the 'Initiating Party Scheme Name' in " + "the PAIN files generated by Odoo.") def _default_initiating_party(self): '''This method is called from post_install.py''' diff --git a/account_banking_pain_base/models/res_config_settings.py b/account_banking_pain_base/models/res_config_settings.py index c59e4569d..60d804969 100644 --- a/account_banking_pain_base/models/res_config_settings.py +++ b/account_banking_pain_base/models/res_config_settings.py @@ -12,6 +12,8 @@ class ResConfigSettings(models.TransientModel): related='company_id.initiating_party_issuer') initiating_party_identifier = fields.Char( related='company_id.initiating_party_identifier') + initiating_party_scheme = fields.Char( + related='company_id.initiating_party_scheme') group_pain_multiple_identifier = fields.Boolean( string='Multiple identifiers', implied_group='account_banking_pain_base.' diff --git a/account_banking_pain_base/views/account_payment_mode.xml b/account_banking_pain_base/views/account_payment_mode.xml index 5401bde00..2334125fb 100644 --- a/account_banking_pain_base/views/account_payment_mode.xml +++ b/account_banking_pain_base/views/account_payment_mode.xml @@ -15,6 +15,7 @@ +