diff --git a/account_banking_pain_base/README.rst b/account_banking_pain_base/README.rst index fb9b48a2d..df673dbf2 100644 --- a/account_banking_pain_base/README.rst +++ b/account_banking_pain_base/README.rst @@ -39,7 +39,7 @@ Known issues / Roadmap ====================== * no known issues - + Bug Tracker =========== @@ -62,6 +62,7 @@ Contributors * Raphaël Valyi * Sandy Carter * Stefan Rijnhart (Therp) +* Antonio Espinosa Maintainer ---------- diff --git a/account_banking_pain_base/__openerp__.py b/account_banking_pain_base/__openerp__.py index c18b82d6b..39ecf238b 100644 --- a/account_banking_pain_base/__openerp__.py +++ b/account_banking_pain_base/__openerp__.py @@ -1,16 +1,18 @@ # -*- coding: utf-8 -*- # © 2013-2015 Akretion - Alexis de Lattre # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Account Banking PAIN Base Module', 'summary': 'Base module for PAIN file generation', - 'version': '8.0.0.3.0', + 'version': '8.0.0.4.0', 'license': 'AGPL-3', 'author': "Akretion, " "Noviat, " "Serv. Tecnol. Avanzados - Pedro M. Baeza, " + "Antiun Ingeniería S.L., " "Odoo Community Association (OCA)", 'website': 'https://github.com/OCA/bank-payment', 'contributors': ['Pedro M. Baeza '], diff --git a/account_banking_pain_base/models/banking_export_pain.py b/account_banking_pain_base/models/banking_export_pain.py index 6d2ea34ab..c25229c42 100644 --- a/account_banking_pain_base/models/banking_export_pain.py +++ b/account_banking_pain_base/models/banking_export_pain.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # © 2013-2015 Akretion - Alexis de Lattre # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, api, _ @@ -234,12 +235,13 @@ class BankingExportPain(models.AbstractModel): initiating_party_1_8 = etree.SubElement(parent_node, 'InitgPty') initiating_party_name = etree.SubElement(initiating_party_1_8, 'Nm') initiating_party_name.text = my_company_name - initiating_party_identifier =\ - self.payment_order_ids[0].company_id.\ - initiating_party_identifier - initiating_party_issuer =\ - self.payment_order_ids[0].company_id.\ - initiating_party_issuer + payment = self.payment_order_ids[0] + initiating_party_identifier = ( + payment.mode.initiating_party_identifier or + payment.company_id.initiating_party_identifier) + initiating_party_issuer = ( + payment.mode.initiating_party_issuer or + payment.company_id.initiating_party_issuer) if initiating_party_identifier and initiating_party_issuer: iniparty_id = etree.SubElement(initiating_party_1_8, 'Id') iniparty_org_id = etree.SubElement(iniparty_id, 'OrgId') @@ -254,7 +256,7 @@ class BankingExportPain(models.AbstractModel): _("Missing 'Initiating Party Issuer' and/or " "'Initiating Party Identifier' for the company '%s'. " "Both fields must have a value.") - % self.payment_order_ids[0].company_id.name) + % payment.company_id.name) return True @api.model diff --git a/account_banking_pain_base/models/payment_mode.py b/account_banking_pain_base/models/payment_mode.py index 1ccc72fe5..832ff2bc9 100644 --- a/account_banking_pain_base/models/payment_mode.py +++ b/account_banking_pain_base/models/payment_mode.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # © 2013-2015 Akretion - Alexis de Lattre # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, fields +from openerp import models, fields, api class PaymentMode(models.Model): @@ -14,3 +15,35 @@ class PaymentMode(models.Model): help="If active, Odoo will convert each accented caracter to " "the corresponding unaccented caracter, so that only ASCII " "caracters are used in the generated PAIN file.") + initiating_party_issuer = fields.Char( + string='Initiating Party Issuer', size=35, + help="This will be used as the 'Initiating Party Issuer' in the " + "PAIN files generated by Odoo. If not defined, Initiating Party " + "Issuer from company will be used.\n" + "Common format (13): \n" + "- Country code (2, optional)\n" + "- Company idenfier (N, VAT)\n" + "- Service suffix (N, issued by bank)") + initiating_party_identifier = fields.Char( + string='Initiating Party Identifier', size=35, + help="This will be used as the 'Initiating Party Identifier' in " + "the PAIN files generated by Odoo. If not defined, Initiating Party " + "Identifier from company will be used.\n" + "Common format (13): \n" + "- Country code (2, optional)\n" + "- Company idenfier (N, VAT)\n" + "- Service suffix (N, issued by bank)") + sepa_type = fields.Char(compute="_compute_sepa_type") + + def _sepa_type_get(self): + """Defined to be inherited by child addons, for instance: + - account_banking_sepa_credit_transfer + - account_banking_sepa_direct_debit + """ + return False + + @api.multi + @api.depends('type') + def _compute_sepa_type(self): + for mode in self: + mode.sepa_type = mode._sepa_type_get() diff --git a/account_banking_pain_base/views/payment_mode_view.xml b/account_banking_pain_base/views/payment_mode_view.xml index 2deb24999..3ab148671 100644 --- a/account_banking_pain_base/views/payment_mode_view.xml +++ b/account_banking_pain_base/views/payment_mode_view.xml @@ -2,6 +2,7 @@ @@ -15,6 +16,16 @@ + + + + + + + + +