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

Proposed by Oihane (Avanzosc) on 2014-08-04
Status: Merged
Merged at revision: 8
Proposed branch: lp:~avanzosc/sepa-tools/7.0
Merge into: lp:sepa-tools
Diff against target: 468 lines (+423/-0)
8 files modified
l10n_es_iban_converter/__init__.py (+24/-0)
l10n_es_iban_converter/__openerp__.py (+46/-0)
l10n_es_iban_converter/i18n/es.po (+83/-0)
l10n_es_iban_converter/i18n/l10n_es_iban_converter.pot (+83/-0)
l10n_es_iban_converter/views/res_partner_view_ext.xml (+10/-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 (+31/-0)
To merge this branch: bzr merge lp:~avanzosc/sepa-tools/7.0
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza code review 2014-08-04 Approve on 2014-08-04
Ignacio Ibeas (www.acysos.com) 2014-08-06 Pending
Review via email: mp+229446@code.launchpad.net
To post a comment you must log in.
Pedro Manuel Baeza (pedro.baeza) wrote :

Some comments inline.

Regards.

review: Needs Fixing (code review)
Oihane (Avanzosc) (oihanecruce) wrote :

Sorry I forgot to pass again Flake8 to validate if all the code was pep8 complaining

lp:~avanzosc/sepa-tools/7.0 updated on 2014-08-04
9. By Oihane (Avanzosc) on 2014-08-04

[MOD] Modifications requested on MP

Oihane (Avanzosc) (oihanecruce) wrote :

Ready for other review

Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM

review: Approve (code review)
lp:~avanzosc/sepa-tools/7.0 updated on 2014-08-05
10. By Oihane (Avanzosc) on 2014-08-05

[FIX] Little mistake solved, worked wrongly

11. By Oihane (Avanzosc) on 2014-08-05

[MOD] Description adapted

12. By Oihane (Avanzosc) on 2014-08-05

[MOD] Format acc_number

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-05 10:25:46 +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-05 10:25:46 +0000
@@ -0,0 +1,46 @@
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 "data": [
41 'wizard/wizard_partner_cc_iban_view.xml',
42 'views/res_partner_view_ext.xml',
43 ],
44 'installable': True,
45 'auto_install': False,
46}
047
=== added directory 'l10n_es_iban_converter/i18n'
=== 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 10:25:46 +0000
@@ -0,0 +1,83 @@
1# Translation of Odoo Server.
2# This file contains the translation of the following modules:
3# * l10n_es_iban_converter
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: Odoo Server 8.0rc1\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-08-04 14:03+0000\n"
10"PO-Revision-Date: 2014-08-04 14:03+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#: field:wizard.partner.cc.iban,bank_state:0
20msgid "Bank Account Type"
21msgstr "Tipo de cuenta de banco"
22
23#. module: l10n_es_iban_converter
24#: model:ir.model,name:l10n_es_iban_converter.model_res_partner_bank
25msgid "Bank Accounts"
26msgstr "Cuentas de banco"
27
28#. module: l10n_es_iban_converter
29#: view:wizard.partner.cc.iban:0
30msgid "Cancel"
31msgstr "Cancelar"
32
33#. module: l10n_es_iban_converter
34#: view:wizard.partner.cc.iban:0
35msgid "Convert"
36msgstr "Convertir"
37
38#. module: l10n_es_iban_converter
39#: model:ir.actions.act_window,name:l10n_es_iban_converter.action_partner_to_cciban
40#: view:wizard.partner.cc.iban:0
41msgid "Convert CCC <-> IBAN"
42msgstr "Convertir CCC <-> IBAN"
43
44#. module: l10n_es_iban_converter
45#: field:wizard.partner.cc.iban,create_uid:0
46msgid "Created by"
47msgstr "Creado por"
48
49#. module: l10n_es_iban_converter
50#: field:wizard.partner.cc.iban,create_date:0
51msgid "Created on"
52msgstr "Creado el"
53
54#. module: l10n_es_iban_converter
55#: field:wizard.partner.cc.iban,id:0
56msgid "ID"
57msgstr "ID"
58
59#. module: l10n_es_iban_converter
60#: field:wizard.partner.cc.iban,write_uid:0
61msgid "Last Updated by"
62msgstr "Actualizado por"
63
64#. module: l10n_es_iban_converter
65#: field:wizard.partner.cc.iban,write_date:0
66msgid "Last Updated on"
67msgstr "Actualizado el"
68
69#. module: l10n_es_iban_converter
70#: model:ir.model,name:l10n_es_iban_converter.model_wizard_partner_cc_iban
71msgid "Wizard Partner CC IBAN"
72msgstr "Wizard Partner CC IBAN"
73
74#. module: l10n_es_iban_converter
75#: view:wizard.partner.cc.iban:0
76msgid "You are going to update account number in partners banks, select which type to do you want to change"
77msgstr "Va a actualizar los nĂºmeros de cuenta, elija el tipo de cuenta al que quiere cambiar"
78
79#. module: l10n_es_iban_converter
80#: view:wizard.partner.cc.iban:0
81msgid "or"
82msgstr "o"
83
084
=== added file 'l10n_es_iban_converter/i18n/l10n_es_iban_converter.pot'
--- l10n_es_iban_converter/i18n/l10n_es_iban_converter.pot 1970-01-01 00:00:00 +0000
+++ l10n_es_iban_converter/i18n/l10n_es_iban_converter.pot 2014-08-05 10:25:46 +0000
@@ -0,0 +1,83 @@
1# Translation of Odoo Server.
2# This file contains the translation of the following modules:
3# * l10n_es_iban_converter
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: Odoo Server 8.0rc1\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-08-04 14:05+0000\n"
10"PO-Revision-Date: 2014-08-04 14:05+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#: field:wizard.partner.cc.iban,bank_state:0
20msgid "Bank Account Type"
21msgstr ""
22
23#. module: l10n_es_iban_converter
24#: model:ir.model,name:l10n_es_iban_converter.model_res_partner_bank
25msgid "Bank Accounts"
26msgstr ""
27
28#. module: l10n_es_iban_converter
29#: view:wizard.partner.cc.iban:0
30msgid "Cancel"
31msgstr ""
32
33#. module: l10n_es_iban_converter
34#: view:wizard.partner.cc.iban:0
35msgid "Convert"
36msgstr ""
37
38#. module: l10n_es_iban_converter
39#: model:ir.actions.act_window,name:l10n_es_iban_converter.action_partner_to_cciban
40#: view:wizard.partner.cc.iban:0
41msgid "Convert CCC <-> IBAN"
42msgstr ""
43
44#. module: l10n_es_iban_converter
45#: field:wizard.partner.cc.iban,create_uid:0
46msgid "Created by"
47msgstr ""
48
49#. module: l10n_es_iban_converter
50#: field:wizard.partner.cc.iban,create_date:0
51msgid "Created on"
52msgstr ""
53
54#. module: l10n_es_iban_converter
55#: field:wizard.partner.cc.iban,id:0
56msgid "ID"
57msgstr ""
58
59#. module: l10n_es_iban_converter
60#: field:wizard.partner.cc.iban,write_uid:0
61msgid "Last Updated by"
62msgstr ""
63
64#. module: l10n_es_iban_converter
65#: field:wizard.partner.cc.iban,write_date:0
66msgid "Last Updated on"
67msgstr ""
68
69#. module: l10n_es_iban_converter
70#: model:ir.model,name:l10n_es_iban_converter.model_wizard_partner_cc_iban
71msgid "Wizard Partner CC IBAN"
72msgstr ""
73
74#. module: l10n_es_iban_converter
75#: view:wizard.partner.cc.iban:0
76msgid "You are going to update account number in partners banks, select which type to do you want to change"
77msgstr ""
78
79#. module: l10n_es_iban_converter
80#: view:wizard.partner.cc.iban:0
81msgid "or"
82msgstr ""
83
084
=== added directory 'l10n_es_iban_converter/views'
=== added file 'l10n_es_iban_converter/views/res_partner_view_ext.xml'
--- l10n_es_iban_converter/views/res_partner_view_ext.xml 1970-01-01 00:00:00 +0000
+++ l10n_es_iban_converter/views/res_partner_view_ext.xml 2014-08-05 10:25:46 +0000
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<openerp>
3 <data>
4 <!-- ACTION partner To CC IBAN -->
5 <act_window id="action_partner_to_cciban" key2="client_action_multi"
6 name="Convert CCC &lt;-&gt; IBAN" res_model="wizard.partner.cc.iban"
7 src_model="res.partner" view_id="wizard_partner_cc_iban_view"
8 view_mode="form" target="new" view_type="form" />
9 </data>
10</openerp>
0\ No newline at end of file11\ No newline at end of file
112
=== 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 10:25:46 +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-05 10:25:46 +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.country_id
63 if not country:
64 country = partner.country_id
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-05 10:25:46 +0000
@@ -0,0 +1,31 @@
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" version="7.0">
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 <footer>
18 <group colspan="8" col="8">
19 <button name="update_cc_iban" string="Convert"
20 type="object" class="oe_highlight" />
21 or
22 <button special="cancel" string="Cancel" />
23 </group>
24 </footer>
25
26 </form>
27 </field>
28 </record>
29
30 </data>
31</openerp>
0\ No newline at end of file32\ No newline at end of file

Subscribers

People subscribed via source and target branches