Merge lp:~avanzosc/sepa-tools/6.1 into lp:sepa-tools/6.1

Proposed by Oihane (Avanzosc)
Status: Needs review
Proposed branch: lp:~avanzosc/sepa-tools/6.1
Merge into: lp:sepa-tools/6.1
Diff against target: 391 lines (+353/-0)
7 files modified
l10n_es_iban_converter/__init__.py (+24/-0)
l10n_es_iban_converter/__openerp__.py (+44/-0)
l10n_es_iban_converter/i18n/base_iban_converter.pot (+49/-0)
l10n_es_iban_converter/i18n/es.po (+49/-0)
l10n_es_iban_converter/wizard/__init__.py (+24/-0)
l10n_es_iban_converter/wizard/wizard_partner_cc_iban.py (+122/-0)
l10n_es_iban_converter/wizard/wizard_partner_cc_iban_view.xml (+41/-0)
To merge this branch: bzr merge lp:~avanzosc/sepa-tools/6.1
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza code review Approve
Ignacio Ibeas (www.acysos.com) Pending
Review via email: mp+229563@code.launchpad.net
To post a comment you must log in.
lp:~avanzosc/sepa-tools/6.1 updated
13. By Oihane (Avanzosc)

[MOD] Description adapted

14. By Oihane (Avanzosc)

[MOD] Format acc_number

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Some comments inline

review: Needs Fixing (code review)
Revision history for this message
Oihane (Avanzosc) (oihanecruce) wrote :

Is it necessary to put "from . import" it is version 6.1 and there is another version for 7.0

lp:~avanzosc/sepa-tools/6.1 updated
15. By Oihane (Avanzosc)

[MOD] Requested modifications

Revision history for this message
Oihane (Avanzosc) (oihanecruce) wrote :

Ready for review

Revision history for this message
Oihane (Avanzosc) (oihanecruce) wrote :

Ready for review

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM

review: Approve (code review)

Unmerged revisions

15. By Oihane (Avanzosc)

[MOD] Requested modifications

14. By Oihane (Avanzosc)

[MOD] Format acc_number

13. By Oihane (Avanzosc)

[MOD] Description adapted

12. By Oihane (Avanzosc)

[ADD] New module <l10n_es_iban_converter>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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-06 11:31:37 +0000
@@ -0,0 +1,24 @@
1# -*- encoding: utf-8 -*-
2########################################################################
3#
4# @authors: Ignacio Ibeas <ignacio@acysos.com>
5# Copyright (C) 2013 Acysos S.L.
6#
7#This program is free software: you can redistribute it and/or modify
8#it under the terms of the GNU General Public License as published by
9#the Free Software Foundation, either version 3 of the License, or
10#(at your option) any later version.
11#
12# This module is GPLv3 or newer and incompatible
13# with OpenERP SA "AGPL + Private Use License"!
14#
15#This program is distributed in the hope that it will be useful,
16#but WITHOUT ANY WARRANTY; without even the implied warranty of
17#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18#GNU General Public License for more details.
19#
20#You should have received a copy of the GNU General Public License
21#along with this program. If not, see http://www.gnu.org/licenses.
22########################################################################
23
24from . import wizard
025
=== 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-06 11:31:37 +0000
@@ -0,0 +1,44 @@
1# -*- encoding: utf-8 -*-
2########################################################################
3#
4# @authors: Ignacio Ibeas <ignacio@acysos.com>
5# Copyright (C) 2013 Acysos S.L.
6#
7#This program is free software: you can redistribute it and/or modify
8#it under the terms of the GNU General Public License as published by
9#the Free Software Foundation, either version 3 of the License, or
10#(at your option) any later version.
11#
12# This module is GPLv3 or newer and incompatible
13# with OpenERP SA "AGPL + Private Use License"!
14#
15#This program is distributed in the hope that it will be useful,
16#but WITHOUT ANY WARRANTY; without even the implied warranty of
17#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18#GNU General Public License for more details.
19#
20#You should have received a copy of the GNU General Public License
21#along with this program. If not, see http://www.gnu.org/licenses.
22########################################################################
23
24{
25 "name": "IBAN Converter - Spanish localization",
26 "version": "1.0",
27 "depends": [
28 "base",
29 "base_iban",
30 "l10n_es_partner",
31 ],
32 "author": "Acysos S.L., Avanzosc S.L.",
33 "website": "http://www.acysos.com, http://www.avanzosc.com",
34 "category": "Tools",
35 "complexity": "normal",
36 "description": """
37This module create one action in res.partner object to convert CCC to IBAN
38and vice versa.
39 """,
40 'update_xml': [
41 'wizard/wizard_partner_cc_iban_view.xml',
42 ],
43 'installable': True,
44}
045
=== 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-06 11:31:37 +0000
@@ -0,0 +1,49 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * l10n_es_iban_converter
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.1\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-08-05 07:33+0000\n"
10"PO-Revision-Date: 2014-08-05 07:33+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: l10n_es_iban_converter
19#: view:wizard.partner.cc.iban:0
20#: model:ir.actions.act_window,name:l10n_es_iban_converter.action_partner_to_cciban
21#: model:ir.actions.act_window,name:l10n_es_iban_converter.shorcut_partner_to_cciban
22msgid "Convert CCC <-> IBAN"
23msgstr ""
24
25#. module: l10n_es_iban_converter
26#: view:wizard.partner.cc.iban:0
27msgid "Ok"
28msgstr ""
29
30#. module: l10n_es_iban_converter
31#: model:ir.model,name:l10n_es_iban_converter.model_wizard_partner_cc_iban
32msgid "Wizard Partner CC IBAN"
33msgstr ""
34
35#. module: l10n_es_iban_converter
36#: view:wizard.partner.cc.iban:0
37msgid "Cancel"
38msgstr ""
39
40#. module: l10n_es_iban_converter
41#: field:wizard.partner.cc.iban,bank_state:0
42msgid "Bank Account Type"
43msgstr ""
44
45#. module: l10n_es_iban_converter
46#: view:wizard.partner.cc.iban:0
47msgid "You are going to update account number in partners banks, select which type to do you want to change"
48msgstr ""
49
050
=== 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-06 11:31:37 +0000
@@ -0,0 +1,49 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * l10n_es_iban_converter
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.1\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-08-05 07:35+0000\n"
10"PO-Revision-Date: 2014-08-05 07:35+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: l10n_es_iban_converter
19#: view:wizard.partner.cc.iban:0
20#: model:ir.actions.act_window,name:l10n_es_iban_converter.action_partner_to_cciban
21#: model:ir.actions.act_window,name:l10n_es_iban_converter.shorcut_partner_to_cciban
22msgid "Convert CCC <-> IBAN"
23msgstr "Convertir CCC <-> IBAN"
24
25#. module: l10n_es_iban_converter
26#: view:wizard.partner.cc.iban:0
27msgid "Ok"
28msgstr "Aceptar"
29
30#. module: l10n_es_iban_converter
31#: model:ir.model,name:l10n_es_iban_converter.model_wizard_partner_cc_iban
32msgid "Wizard Partner CC IBAN"
33msgstr "Wizard Partner CC IBAN"
34
35#. module: l10n_es_iban_converter
36#: view:wizard.partner.cc.iban:0
37msgid "Cancel"
38msgstr "Cancelar"
39
40#. module: l10n_es_iban_converter
41#: field:wizard.partner.cc.iban,bank_state:0
42msgid "Bank Account Type"
43msgstr "Tipo de cuenta de banco"
44
45#. module: l10n_es_iban_converter
46#: view:wizard.partner.cc.iban:0
47msgid "You are going to update account number in partners banks, select which type to do you want to change"
48msgstr "Va a actualizar los números de cuenta, elija el tipo de cuenta al que quiere cambiar"
49
050
=== 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-06 11:31:37 +0000
@@ -0,0 +1,24 @@
1# -*- encoding: utf-8 -*-
2########################################################################
3#
4# @authors: Ignacio Ibeas <ignacio@acysos.com>
5# Copyright (C) 2013 Acysos S.L.
6#
7#This program is free software: you can redistribute it and/or modify
8#it under the terms of the GNU General Public License as published by
9#the Free Software Foundation, either version 3 of the License, or
10#(at your option) any later version.
11#
12# This module is GPLv3 or newer and incompatible
13# with OpenERP SA "AGPL + Private Use License"!
14#
15#This program is distributed in the hope that it will be useful,
16#but WITHOUT ANY WARRANTY; without even the implied warranty of
17#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18#GNU General Public License for more details.
19#
20#You should have received a copy of the GNU General Public License
21#along with this program. If not, see http://www.gnu.org/licenses.
22########################################################################
23
24from . import wizard_partner_cc_iban
025
=== 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-06 11:31:37 +0000
@@ -0,0 +1,122 @@
1# -*- encoding: utf-8 -*-
2########################################################################
3#
4# @authors: Ignacio Ibeas <ignacio@acysos.com>
5# Copyright (C) 2013 Acysos S.L.
6#
7#This program is free software: you can redistribute it and/or modify
8#it under the terms of the GNU General Public License as published by
9#the Free Software Foundation, either version 3 of the License, or
10#(at your option) any later version.
11#
12# This module is GPLv3 or newer and incompatible
13# with OpenERP SA "AGPL + Private Use License"!
14#
15#This program is distributed in the hope that it will be useful,
16#but WITHOUT ANY WARRANTY; without even the implied warranty of
17#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18#GNU General Public License for more details.
19#
20#You should have received a copy of the GNU General Public License
21#along with this program. If not, see http://www.gnu.org/licenses.
22########################################################################
23
24from openerp.osv import fields, orm
25
26from openerp.addons.base_iban.base_iban import _pretty_iban
27
28
29_mapping = {'A': '10', 'B': '11', 'C': '12', 'D': '13', 'E': '14', 'F': '15',
30 'G': '16', 'H': '17', 'I': '18', 'J': '19', 'K': '20', 'L': '21',
31 'M': '22', 'N': '23', 'O': '24', 'P': '25', 'Q': '26', 'R': '27',
32 'S': '28', 'T': '29', 'U': '30', 'V': '31', 'W': '32', 'X': '33',
33 'Y': '34', 'Z': '35'}
34
35
36class WizardPartnerCcIban(orm.TransientModel):
37 _name = "wizard.partner.cc.iban"
38 _description = "Wizard Partner CC IBAN"
39
40 def _bank_type_get(self, cr, uid, context=None):
41 partner_bank_obj = self.pool['res.partner.bank']
42 return partner_bank_obj._bank_type_get(cr, uid, context=context)
43
44 _columns = {
45 'bank_state': fields.selection(_bank_type_get, 'Bank Account Type',
46 required=True),
47 }
48
49 def update_cc_iban(self, cr, uid, ids, context=None):
50 if context is None:
51 context = {}
52 data = self.read(cr, uid, ids, context=context)[0]
53 bank_obj = self.pool['res.partner.bank']
54 partner_obj = self.pool['res.partner']
55 partner_ids = context.get('active_ids')
56 if partner_ids:
57 for partner in partner_obj.browse(cr, uid, partner_ids,
58 context=context):
59 if partner.bank_ids:
60 for bank in partner.bank_ids:
61 new_data = {}
62 country = bank.acc_country_id
63 if not country:
64 country = partner.country
65 new_data['country_id'] = country.id
66 if bank.state == data['bank_state']:
67 continue
68 if bank.state == 'bank':
69 iban = self.convert_to_iban(cr, uid,
70 bank.acc_number,
71 country.code,
72 context=context)
73 values = bank_obj.onchange_banco(cr, uid, ids,
74 iban, country.id,
75 'iban',
76 context=context)
77 new_data.update(
78 {'acc_number': values['value']['acc_number'],
79 'state': 'iban'})
80 elif bank.state == 'iban':
81 ccc = self.convert_to_ccc(cr, uid, bank.acc_number,
82 context=context)
83 values = bank_obj.onchange_banco(cr, uid, ids, ccc,
84 country.id,
85 'bank',
86 context=context)
87 new_data.update(
88 {'acc_number': values['value']['acc_number'],
89 'state': 'bank'})
90 if (not bank.bank or not bank.bank_bic) and \
91 'bank' in values['value']:
92 bank_data = bank_obj.onchange_bank_id(
93 cr, uid, ids, values['value']['bank'],
94 context=context)
95 new_data.update(
96 {'bank': values['value']['bank'],
97 'bank_bic': bank_data['value']['bank_bic'],
98 'bank_name': bank_data['value']['bank_name']})
99 bank_obj.write(cr, uid, [bank.id], new_data,
100 context=context)
101 return {'type': 'ir.actions.act_window_close'}
102
103 def convert_to_iban(self, cr, uid, acc_number, country_code, context=None):
104 code_char = _mapping[country_code[:1]] + _mapping[country_code[1:]]
105 ccc = acc_number.replace(" ", "")
106 for key, replacement in _mapping.items():
107 ccc_number = ccc.replace(key, replacement)
108 ccc_convert = int(ccc_number + code_char + '00')
109 remainder = ccc_convert % 97
110 control_digit = 98 - remainder
111 if control_digit < 10:
112 control_digit = '0' + str(control_digit)
113 else:
114 control_digit = str(control_digit)
115 iban = _pretty_iban(country_code + control_digit + str(ccc))
116 return iban
117
118 def convert_to_ccc(self, cr, uid, acc_number, context=None):
119 ccc = acc_number.replace(" ", "")
120 acc_number = ccc[4:]
121 return "%s %s %s %s" % (acc_number[0:4], acc_number[4:8],
122 acc_number[8:10], acc_number[10:])
0123
=== 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-06 11:31:37 +0000
@@ -0,0 +1,41 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<openerp>
3 <data>
4
5 <record id="wizard_partner_cc_iban_view" model="ir.ui.view">
6 <field name="name">wizard.partner.cc.iban.view</field>
7 <field name="model">wizard.partner.cc.iban</field>
8 <field name="type">form</field>
9 <field name="arch" type="xml">
10 <form string="Convert CCC &lt;-&gt; IBAN">
11 <group colspan="4">
12 <separator colspan="4" />
13 <label
14 string="You are going to update account number in partners banks, select which type to do you want to change" />
15 <field name="bank_state" nolabel="1" />
16 </group>
17 <group colspan="4">
18 <button icon='gtk-cancel' special="cancel"
19 string="Cancel" />
20 <button name="update_cc_iban" icon='gtk-ok'
21 type="object" string="Ok" />
22 </group>
23 </form>
24 </field>
25 </record>
26
27 <!-- ACTION partner To CC IBAN -->
28 <act_window id="action_partner_to_cciban" key2="client_action_multi"
29 name="Convert CCC &lt;-&gt; IBAN" res_model="wizard.partner.cc.iban"
30 src_model="res.partner" view_id="wizard_partner_cc_iban_view"
31 view_mode="form" target="new" view_type="form"
32 groups="base.group_extended" />
33
34 <!-- SHORCUT partner to CC IBAN -->
35 <act_window context="{'active_ids':[active_id]}" id="shorcut_partner_to_cciban"
36 name="Convert CCC &lt;-&gt; IBAN" res_model="wizard.partner.cc.iban"
37 src_model="res.partner" view_type="form" view_mode="form"
38 target="new" />
39
40 </data>
41</openerp>
0\ No newline at end of file42\ No newline at end of file

Subscribers

People subscribed via source and target branches