From f164025afbc47e6656f836dfc4bece71b46717da Mon Sep 17 00:00:00 2001 From: "Ignacio Ibeas - Acysos S.L" Date: Thu, 13 Feb 2014 17:21:09 +0100 Subject: [PATCH] [FIX] account_banking_pain_base: support party identifier for Spain --- account_banking_pain_base/__openerp__.py | 11 ++++++++--- account_banking_pain_base/company.py | 8 ++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/account_banking_pain_base/__openerp__.py b/account_banking_pain_base/__openerp__.py index 71c52d5d0..f2a6ad0d0 100644 --- a/account_banking_pain_base/__openerp__.py +++ b/account_banking_pain_base/__openerp__.py @@ -40,11 +40,16 @@ Base module for PAIN file generation ==================================== -This module contains fields and functions that are used by the module for SEPA Credit Transfer (account_banking_sepa_credit_transfer) and SEPA Direct Debit (account_banking_sepa_direct_debit). This module doesn't provide any functionnality by itself. +This module contains fields and functions that are used by the module for SEPA +Credit Transfer (account_banking_sepa_credit_transfer) and SEPA Direct Debit +(account_banking_sepa_direct_debit). This module doesn't provide any +functionnality by itself. -This module is part of the banking addons: https://launchpad.net/banking-addons +This module is part of the banking addons: + https://www.github.com/OCA/banking-addons -This module was started during the Akretion-Noviat code sprint of November 21st 2013 in Epiais les Louvres (France). +This module was started during the Akretion-Noviat code sprint of +November 21st 2013 in Epiais les Louvres (France). ''', 'active': False, 'installable': True, diff --git a/account_banking_pain_base/company.py b/account_banking_pain_base/company.py index 2c238cc6a..222786c27 100644 --- a/account_banking_pain_base/company.py +++ b/account_banking_pain_base/company.py @@ -45,8 +45,12 @@ class res_company(orm.Model): company = self.browse(cr, uid, company_id, context=context) company_vat = company.vat party_identifier = False - if company_vat and company_vat[0:2].upper() in ['BE']: - party_identifier = company_vat[2:].replace(' ', '') + if company_vat: + country_code = company_vat[0:2].upper() + if country_code == 'BE': + party_identifier = company_vat[2:].replace(' ', '') + elif country_code == 'ES': + party_identifier = company.sepa_creditor_identifier return party_identifier def _initiating_party_issuer_default(self, cr, uid, context=None):