Oihane (Avanzosc) has proposed merging lp:~avanzosc/sepa-tools/6.0 into lp:sepa-tools/6.0.
Requested reviews: Pedro Manuel Baeza (pedro.baeza) For more details, see: https://code.launchpad.net/~avanzosc/sepa-tools/6.0/+merge/229576 -- https://code.launchpad.net/~avanzosc/sepa-tools/6.0/+merge/229576 Your team Avanzosc Developers is subscribed to branch lp:~avanzosc/sepa-tools/6.0.
=== added directory 'l10n_es_iban_converter' === added file 'l10n_es_iban_converter/__init__.py' --- l10n_es_iban_converter/__init__.py 1970-01-01 00:00:00 +0000 +++ l10n_es_iban_converter/__init__.py 2014-08-05 09:00:23 +0000 @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +######################################################################## +# +# @authors: Ignacio Ibeas <[email protected]> +# Copyright (C) 2013 Acysos S.L. +# +#This program is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, either version 3 of the License, or +#(at your option) any later version. +# +# This module is GPLv3 or newer and incompatible +# with OpenERP SA "AGPL + Private Use License"! +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with this program. If not, see http://www.gnu.org/licenses. +######################################################################## + +import wizard === added file 'l10n_es_iban_converter/__openerp__.py' --- l10n_es_iban_converter/__openerp__.py 1970-01-01 00:00:00 +0000 +++ l10n_es_iban_converter/__openerp__.py 2014-08-05 09:00:23 +0000 @@ -0,0 +1,44 @@ +# -*- encoding: utf-8 -*- +######################################################################## +# +# @authors: Ignacio Ibeas <[email protected]> +# Copyright (C) 2013 Acysos S.L. +# +#This program is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, either version 3 of the License, or +#(at your option) any later version. +# +# This module is GPLv3 or newer and incompatible +# with OpenERP SA "AGPL + Private Use License"! +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with this program. If not, see http://www.gnu.org/licenses. +######################################################################## + +{ + "name": "IBAN Converter - Spanish localization", + "version": "1.0", + "depends": [ + "base", + "base_iban", + "l10n_es_partner", + ], + "author": "Acysos S.L., Avanzosc S.L.", + "website": "http://www.acysos.com, http://www.avanzosc.com", + "category": "Tools", + "complexity": "normal", + "description": """ +This module create one action in res.partner object to convert CCC to IBAN +and vice versa. + """, + 'update_xml': [ + 'wizard/wizard_partner_cc_iban_view.xml', + ], + 'installable': True, +} === added directory 'l10n_es_iban_converter/i18n' === added file 'l10n_es_iban_converter/i18n/base_iban_converter.pot' --- l10n_es_iban_converter/i18n/base_iban_converter.pot 1970-01-01 00:00:00 +0000 +++ l10n_es_iban_converter/i18n/base_iban_converter.pot 2014-08-05 09:00:23 +0000 @@ -0,0 +1,48 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * l10n_es_iban_converter +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0.4\n" +"Report-Msgid-Bugs-To: [email protected]\n" +"POT-Creation-Date: 2014-08-05 08:47+0000\n" +"PO-Revision-Date: 2014-08-05 08:47+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_es_iban_converter +#: model:ir.actions.act_window,name:l10n_es_iban_converter.action_partner_to_cciban +#: view:wizard.partner.cc.iban:0 +msgid "Convert CCC <-> IBAN" +msgstr "" + +#. module: l10n_es_iban_converter +#: view:wizard.partner.cc.iban:0 +msgid "Ok" +msgstr "" + +#. module: l10n_es_iban_converter +#: model:ir.model,name:l10n_es_iban_converter.model_wizard_partner_cc_iban +msgid "Wizard Partner CC IBAN" +msgstr "" + +#. module: l10n_es_iban_converter +#: view:wizard.partner.cc.iban:0 +msgid "Cancel" +msgstr "" + +#. module: l10n_es_iban_converter +#: field:wizard.partner.cc.iban,bank_state:0 +msgid "Bank Account Type" +msgstr "" + +#. module: l10n_es_iban_converter +#: view:wizard.partner.cc.iban:0 +msgid "You are going to update account number in partners banks, select which type to do you want to change" +msgstr "" + === added file 'l10n_es_iban_converter/i18n/es.po' --- l10n_es_iban_converter/i18n/es.po 1970-01-01 00:00:00 +0000 +++ l10n_es_iban_converter/i18n/es.po 2014-08-05 09:00:23 +0000 @@ -0,0 +1,48 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * l10n_es_iban_converter +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0.4\n" +"Report-Msgid-Bugs-To: [email protected]\n" +"POT-Creation-Date: 2014-08-05 08:50+0000\n" +"PO-Revision-Date: 2014-08-05 10:57+0100\n" +"Last-Translator: Oihane <[email protected]>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" + +#. module: l10n_es_iban_converter +#: model:ir.actions.act_window,name:l10n_es_iban_converter.action_partner_to_cciban +#: view:wizard.partner.cc.iban:0 +msgid "Convert CCC <-> IBAN" +msgstr "Convertir CCC <-> IBAN" + +#. module: l10n_es_iban_converter +#: view:wizard.partner.cc.iban:0 +msgid "Ok" +msgstr "Ok" + +#. module: l10n_es_iban_converter +#: model:ir.model,name:l10n_es_iban_converter.model_wizard_partner_cc_iban +msgid "Wizard Partner CC IBAN" +msgstr "Wizard Partner CC IBAN" + +#. module: l10n_es_iban_converter +#: view:wizard.partner.cc.iban:0 +msgid "Cancel" +msgstr "Cancelar" + +#. module: l10n_es_iban_converter +#: field:wizard.partner.cc.iban,bank_state:0 +msgid "Bank Account Type" +msgstr "Tipo de cuenta de banco" + +#. module: l10n_es_iban_converter +#: view:wizard.partner.cc.iban:0 +msgid "You are going to update account number in partners banks, select which type to do you want to change" +msgstr "Va a actualizar los nĂºmeros de cuenta, elija el tipo de cuenta al que quiere cambiar" + === added directory 'l10n_es_iban_converter/wizard' === added file 'l10n_es_iban_converter/wizard/__init__.py' --- l10n_es_iban_converter/wizard/__init__.py 1970-01-01 00:00:00 +0000 +++ l10n_es_iban_converter/wizard/__init__.py 2014-08-05 09:00:23 +0000 @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +######################################################################## +# +# @authors: Ignacio Ibeas <[email protected]> +# Copyright (C) 2013 Acysos S.L. +# +#This program is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, either version 3 of the License, or +#(at your option) any later version. +# +# This module is GPLv3 or newer and incompatible +# with OpenERP SA "AGPL + Private Use License"! +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with this program. If not, see http://www.gnu.org/licenses. +######################################################################## + +import wizard_partner_cc_iban === added file 'l10n_es_iban_converter/wizard/wizard_partner_cc_iban.py' --- l10n_es_iban_converter/wizard/wizard_partner_cc_iban.py 1970-01-01 00:00:00 +0000 +++ l10n_es_iban_converter/wizard/wizard_partner_cc_iban.py 2014-08-05 09:00:23 +0000 @@ -0,0 +1,104 @@ +# -*- encoding: utf-8 -*- +######################################################################## +# +# @authors: Ignacio Ibeas <[email protected]> +# Copyright (C) 2013 Acysos S.L. +# +#This program is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, either version 3 of the License, or +#(at your option) any later version. +# +# This module is GPLv3 or newer and incompatible +# with OpenERP SA "AGPL + Private Use License"! +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with this program. If not, see http://www.gnu.org/licenses. +######################################################################## + +from osv import fields, osv +from tools.translate import _ + + +_mapping = {'A': '10', 'B': '11', 'C': '12', 'D': '13', 'E': '14', 'F': '15', + 'G': '16', 'H': '17', 'I': '18', 'J': '19', 'K': '20', 'L': '21', + 'M': '22', 'N': '23', 'O': '24', 'P': '25', 'Q': '26', 'R': '27', + 'S': '28', 'T': '29', 'U': '30', 'V': '31', 'W': '32', 'X': '33', + 'Y': '34', 'Z': '35'} + + +class wizard_partner_cc_iban(osv.osv_memory): + _name = "wizard.partner.cc.iban" + _description = "Wizard Partner CC IBAN" + + def _bank_type_get(self, cr, uid, context=None): + partner_bank_obj = self.pool.get('res.partner.bank') + return partner_bank_obj._bank_type_get(cr, uid, context=context) + + _columns = { + 'bank_state': fields.selection(_bank_type_get, 'Bank Account Type', + required=True), + } + + def update_cc_iban(self, cr, uid, ids, context=None): + if context is None: + context = {} + data = self.read(cr, uid, ids, context=context)[0] + bank_obj = self.pool.get('res.partner.bank') + partner_obj = self.pool.get('res.partner') + partner_ids = context.get('active_ids') + if partner_ids: + for partner in partner_obj.browse(cr, uid, partner_ids, + context=context): + if partner.bank_ids: + for bank in partner.bank_ids: + new_data = {} + country = bank.acc_country_id + if not country: + country = bank.bank.country + new_data['acc_country_id'] = country.id + if bank.state == data['bank_state']: + continue + if bank.state == 'bank': + iban = self.convert_to_iban(cr, uid, + bank.acc_number, + country.code, + context=context) + new_data.update( + {'iban': iban, + 'state': 'iban'}) + elif bank.state == 'iban': + ccc = self.convert_to_ccc(cr, uid, bank.iban, + context=context) + new_data.update( + {'acc_number': ccc, + 'state': 'bank'}) + bank_obj.write(cr, uid, [bank.id], new_data, + context=context) + return {'type': 'ir.actions.act_window_close'} + + def convert_to_iban(self, cr, uid, acc_number, country_code, context=None): + code_char = _mapping[country_code[:1]] + _mapping[country_code[1:]] + ccc = acc_number.replace(" ", "") + for key, replacement in _mapping.items(): + ccc_number = ccc.replace(key, replacement) + ccc_convert = int(ccc_number + code_char + '00') + remainder = ccc_convert % 97 + control_digit = 98 - remainder + if control_digit < 10: + control_digit = '0' + str(control_digit) + else: + control_digit = str(control_digit) + iban = country_code + control_digit + str(ccc) + return iban + + def convert_to_ccc(self, cr, uid, iban, context=None): + ccc = iban.replace(" ", "") + return ccc[4:] + +wizard_partner_cc_iban() === added file 'l10n_es_iban_converter/wizard/wizard_partner_cc_iban_view.xml' --- l10n_es_iban_converter/wizard/wizard_partner_cc_iban_view.xml 1970-01-01 00:00:00 +0000 +++ l10n_es_iban_converter/wizard/wizard_partner_cc_iban_view.xml 2014-08-05 09:00:23 +0000 @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<openerp> + <data> + + <record id="wizard_partner_cc_iban_view" model="ir.ui.view"> + <field name="name">wizard.partner.cc.iban.view</field> + <field name="model">wizard.partner.cc.iban</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Convert CCC <-> IBAN"> + <group colspan="4"> + <separator colspan="4" /> + <label + string="You are going to update account number in partners banks, select which type to do you want to change" /> + <field name="bank_state" nolabel="1" /> + </group> + <group colspan="4"> + <button icon='gtk-cancel' special="cancel" + string="Cancel" /> + <button name="update_cc_iban" icon='gtk-ok' + type="object" string="Ok" /> + </group> + </form> + </field> + </record> + + <!-- ACTION partner To CC IBAN --> + <act_window id="action_partner_to_cciban" key2="client_action_multi" + name="Convert CCC <-> IBAN" res_model="wizard.partner.cc.iban" + src_model="res.partner" view_id="wizard_partner_cc_iban_view" + view_mode="form" target="new" view_type="form" + groups="base.group_extended" /> + + </data> +</openerp> \ No newline at end of file
-- Mailing list: https://launchpad.net/~avanzosc Post to : [email protected] Unsubscribe : https://launchpad.net/~avanzosc More help : https://help.launchpad.net/ListHelp

