Merge lp:~avanzosc/sepa-tools/6.1 into lp:sepa-tools/6.1
- 6.1
- Merge into 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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Pedro Manuel Baeza | code review | Approve | |
Ignacio Ibeas (www.acysos.com) | Pending | ||
Review via email:
|
Commit message
Description of the change
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 : | # |
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

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
1 | === added directory 'l10n_es_iban_converter' |
2 | === added file 'l10n_es_iban_converter/__init__.py' |
3 | --- l10n_es_iban_converter/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ l10n_es_iban_converter/__init__.py 2014-08-06 11:31:37 +0000 |
5 | @@ -0,0 +1,24 @@ |
6 | +# -*- encoding: utf-8 -*- |
7 | +######################################################################## |
8 | +# |
9 | +# @authors: Ignacio Ibeas <ignacio@acysos.com> |
10 | +# Copyright (C) 2013 Acysos S.L. |
11 | +# |
12 | +#This program is free software: you can redistribute it and/or modify |
13 | +#it under the terms of the GNU General Public License as published by |
14 | +#the Free Software Foundation, either version 3 of the License, or |
15 | +#(at your option) any later version. |
16 | +# |
17 | +# This module is GPLv3 or newer and incompatible |
18 | +# with OpenERP SA "AGPL + Private Use License"! |
19 | +# |
20 | +#This program is distributed in the hope that it will be useful, |
21 | +#but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23 | +#GNU General Public License for more details. |
24 | +# |
25 | +#You should have received a copy of the GNU General Public License |
26 | +#along with this program. If not, see http://www.gnu.org/licenses. |
27 | +######################################################################## |
28 | + |
29 | +from . import wizard |
30 | |
31 | === added file 'l10n_es_iban_converter/__openerp__.py' |
32 | --- l10n_es_iban_converter/__openerp__.py 1970-01-01 00:00:00 +0000 |
33 | +++ l10n_es_iban_converter/__openerp__.py 2014-08-06 11:31:37 +0000 |
34 | @@ -0,0 +1,44 @@ |
35 | +# -*- encoding: utf-8 -*- |
36 | +######################################################################## |
37 | +# |
38 | +# @authors: Ignacio Ibeas <ignacio@acysos.com> |
39 | +# Copyright (C) 2013 Acysos S.L. |
40 | +# |
41 | +#This program is free software: you can redistribute it and/or modify |
42 | +#it under the terms of the GNU General Public License as published by |
43 | +#the Free Software Foundation, either version 3 of the License, or |
44 | +#(at your option) any later version. |
45 | +# |
46 | +# This module is GPLv3 or newer and incompatible |
47 | +# with OpenERP SA "AGPL + Private Use License"! |
48 | +# |
49 | +#This program is distributed in the hope that it will be useful, |
50 | +#but WITHOUT ANY WARRANTY; without even the implied warranty of |
51 | +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
52 | +#GNU General Public License for more details. |
53 | +# |
54 | +#You should have received a copy of the GNU General Public License |
55 | +#along with this program. If not, see http://www.gnu.org/licenses. |
56 | +######################################################################## |
57 | + |
58 | +{ |
59 | + "name": "IBAN Converter - Spanish localization", |
60 | + "version": "1.0", |
61 | + "depends": [ |
62 | + "base", |
63 | + "base_iban", |
64 | + "l10n_es_partner", |
65 | + ], |
66 | + "author": "Acysos S.L., Avanzosc S.L.", |
67 | + "website": "http://www.acysos.com, http://www.avanzosc.com", |
68 | + "category": "Tools", |
69 | + "complexity": "normal", |
70 | + "description": """ |
71 | +This module create one action in res.partner object to convert CCC to IBAN |
72 | +and vice versa. |
73 | + """, |
74 | + 'update_xml': [ |
75 | + 'wizard/wizard_partner_cc_iban_view.xml', |
76 | + ], |
77 | + 'installable': True, |
78 | +} |
79 | |
80 | === added directory 'l10n_es_iban_converter/i18n' |
81 | === added file 'l10n_es_iban_converter/i18n/base_iban_converter.pot' |
82 | --- l10n_es_iban_converter/i18n/base_iban_converter.pot 1970-01-01 00:00:00 +0000 |
83 | +++ l10n_es_iban_converter/i18n/base_iban_converter.pot 2014-08-06 11:31:37 +0000 |
84 | @@ -0,0 +1,49 @@ |
85 | +# Translation of OpenERP Server. |
86 | +# This file contains the translation of the following modules: |
87 | +# * l10n_es_iban_converter |
88 | +# |
89 | +msgid "" |
90 | +msgstr "" |
91 | +"Project-Id-Version: OpenERP Server 6.1\n" |
92 | +"Report-Msgid-Bugs-To: \n" |
93 | +"POT-Creation-Date: 2014-08-05 07:33+0000\n" |
94 | +"PO-Revision-Date: 2014-08-05 07:33+0000\n" |
95 | +"Last-Translator: <>\n" |
96 | +"Language-Team: \n" |
97 | +"MIME-Version: 1.0\n" |
98 | +"Content-Type: text/plain; charset=UTF-8\n" |
99 | +"Content-Transfer-Encoding: \n" |
100 | +"Plural-Forms: \n" |
101 | + |
102 | +#. module: l10n_es_iban_converter |
103 | +#: view:wizard.partner.cc.iban:0 |
104 | +#: model:ir.actions.act_window,name:l10n_es_iban_converter.action_partner_to_cciban |
105 | +#: model:ir.actions.act_window,name:l10n_es_iban_converter.shorcut_partner_to_cciban |
106 | +msgid "Convert CCC <-> IBAN" |
107 | +msgstr "" |
108 | + |
109 | +#. module: l10n_es_iban_converter |
110 | +#: view:wizard.partner.cc.iban:0 |
111 | +msgid "Ok" |
112 | +msgstr "" |
113 | + |
114 | +#. module: l10n_es_iban_converter |
115 | +#: model:ir.model,name:l10n_es_iban_converter.model_wizard_partner_cc_iban |
116 | +msgid "Wizard Partner CC IBAN" |
117 | +msgstr "" |
118 | + |
119 | +#. module: l10n_es_iban_converter |
120 | +#: view:wizard.partner.cc.iban:0 |
121 | +msgid "Cancel" |
122 | +msgstr "" |
123 | + |
124 | +#. module: l10n_es_iban_converter |
125 | +#: field:wizard.partner.cc.iban,bank_state:0 |
126 | +msgid "Bank Account Type" |
127 | +msgstr "" |
128 | + |
129 | +#. module: l10n_es_iban_converter |
130 | +#: view:wizard.partner.cc.iban:0 |
131 | +msgid "You are going to update account number in partners banks, select which type to do you want to change" |
132 | +msgstr "" |
133 | + |
134 | |
135 | === added file 'l10n_es_iban_converter/i18n/es.po' |
136 | --- l10n_es_iban_converter/i18n/es.po 1970-01-01 00:00:00 +0000 |
137 | +++ l10n_es_iban_converter/i18n/es.po 2014-08-06 11:31:37 +0000 |
138 | @@ -0,0 +1,49 @@ |
139 | +# Translation of OpenERP Server. |
140 | +# This file contains the translation of the following modules: |
141 | +# * l10n_es_iban_converter |
142 | +# |
143 | +msgid "" |
144 | +msgstr "" |
145 | +"Project-Id-Version: OpenERP Server 6.1\n" |
146 | +"Report-Msgid-Bugs-To: \n" |
147 | +"POT-Creation-Date: 2014-08-05 07:35+0000\n" |
148 | +"PO-Revision-Date: 2014-08-05 07:35+0000\n" |
149 | +"Last-Translator: <>\n" |
150 | +"Language-Team: \n" |
151 | +"MIME-Version: 1.0\n" |
152 | +"Content-Type: text/plain; charset=UTF-8\n" |
153 | +"Content-Transfer-Encoding: \n" |
154 | +"Plural-Forms: \n" |
155 | + |
156 | +#. module: l10n_es_iban_converter |
157 | +#: view:wizard.partner.cc.iban:0 |
158 | +#: model:ir.actions.act_window,name:l10n_es_iban_converter.action_partner_to_cciban |
159 | +#: model:ir.actions.act_window,name:l10n_es_iban_converter.shorcut_partner_to_cciban |
160 | +msgid "Convert CCC <-> IBAN" |
161 | +msgstr "Convertir CCC <-> IBAN" |
162 | + |
163 | +#. module: l10n_es_iban_converter |
164 | +#: view:wizard.partner.cc.iban:0 |
165 | +msgid "Ok" |
166 | +msgstr "Aceptar" |
167 | + |
168 | +#. module: l10n_es_iban_converter |
169 | +#: model:ir.model,name:l10n_es_iban_converter.model_wizard_partner_cc_iban |
170 | +msgid "Wizard Partner CC IBAN" |
171 | +msgstr "Wizard Partner CC IBAN" |
172 | + |
173 | +#. module: l10n_es_iban_converter |
174 | +#: view:wizard.partner.cc.iban:0 |
175 | +msgid "Cancel" |
176 | +msgstr "Cancelar" |
177 | + |
178 | +#. module: l10n_es_iban_converter |
179 | +#: field:wizard.partner.cc.iban,bank_state:0 |
180 | +msgid "Bank Account Type" |
181 | +msgstr "Tipo de cuenta de banco" |
182 | + |
183 | +#. module: l10n_es_iban_converter |
184 | +#: view:wizard.partner.cc.iban:0 |
185 | +msgid "You are going to update account number in partners banks, select which type to do you want to change" |
186 | +msgstr "Va a actualizar los nĂºmeros de cuenta, elija el tipo de cuenta al que quiere cambiar" |
187 | + |
188 | |
189 | === added directory 'l10n_es_iban_converter/wizard' |
190 | === added file 'l10n_es_iban_converter/wizard/__init__.py' |
191 | --- l10n_es_iban_converter/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
192 | +++ l10n_es_iban_converter/wizard/__init__.py 2014-08-06 11:31:37 +0000 |
193 | @@ -0,0 +1,24 @@ |
194 | +# -*- encoding: utf-8 -*- |
195 | +######################################################################## |
196 | +# |
197 | +# @authors: Ignacio Ibeas <ignacio@acysos.com> |
198 | +# Copyright (C) 2013 Acysos S.L. |
199 | +# |
200 | +#This program is free software: you can redistribute it and/or modify |
201 | +#it under the terms of the GNU General Public License as published by |
202 | +#the Free Software Foundation, either version 3 of the License, or |
203 | +#(at your option) any later version. |
204 | +# |
205 | +# This module is GPLv3 or newer and incompatible |
206 | +# with OpenERP SA "AGPL + Private Use License"! |
207 | +# |
208 | +#This program is distributed in the hope that it will be useful, |
209 | +#but WITHOUT ANY WARRANTY; without even the implied warranty of |
210 | +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
211 | +#GNU General Public License for more details. |
212 | +# |
213 | +#You should have received a copy of the GNU General Public License |
214 | +#along with this program. If not, see http://www.gnu.org/licenses. |
215 | +######################################################################## |
216 | + |
217 | +from . import wizard_partner_cc_iban |
218 | |
219 | === added file 'l10n_es_iban_converter/wizard/wizard_partner_cc_iban.py' |
220 | --- l10n_es_iban_converter/wizard/wizard_partner_cc_iban.py 1970-01-01 00:00:00 +0000 |
221 | +++ l10n_es_iban_converter/wizard/wizard_partner_cc_iban.py 2014-08-06 11:31:37 +0000 |
222 | @@ -0,0 +1,122 @@ |
223 | +# -*- encoding: utf-8 -*- |
224 | +######################################################################## |
225 | +# |
226 | +# @authors: Ignacio Ibeas <ignacio@acysos.com> |
227 | +# Copyright (C) 2013 Acysos S.L. |
228 | +# |
229 | +#This program is free software: you can redistribute it and/or modify |
230 | +#it under the terms of the GNU General Public License as published by |
231 | +#the Free Software Foundation, either version 3 of the License, or |
232 | +#(at your option) any later version. |
233 | +# |
234 | +# This module is GPLv3 or newer and incompatible |
235 | +# with OpenERP SA "AGPL + Private Use License"! |
236 | +# |
237 | +#This program is distributed in the hope that it will be useful, |
238 | +#but WITHOUT ANY WARRANTY; without even the implied warranty of |
239 | +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
240 | +#GNU General Public License for more details. |
241 | +# |
242 | +#You should have received a copy of the GNU General Public License |
243 | +#along with this program. If not, see http://www.gnu.org/licenses. |
244 | +######################################################################## |
245 | + |
246 | +from openerp.osv import fields, orm |
247 | + |
248 | +from openerp.addons.base_iban.base_iban import _pretty_iban |
249 | + |
250 | + |
251 | +_mapping = {'A': '10', 'B': '11', 'C': '12', 'D': '13', 'E': '14', 'F': '15', |
252 | + 'G': '16', 'H': '17', 'I': '18', 'J': '19', 'K': '20', 'L': '21', |
253 | + 'M': '22', 'N': '23', 'O': '24', 'P': '25', 'Q': '26', 'R': '27', |
254 | + 'S': '28', 'T': '29', 'U': '30', 'V': '31', 'W': '32', 'X': '33', |
255 | + 'Y': '34', 'Z': '35'} |
256 | + |
257 | + |
258 | +class WizardPartnerCcIban(orm.TransientModel): |
259 | + _name = "wizard.partner.cc.iban" |
260 | + _description = "Wizard Partner CC IBAN" |
261 | + |
262 | + def _bank_type_get(self, cr, uid, context=None): |
263 | + partner_bank_obj = self.pool['res.partner.bank'] |
264 | + return partner_bank_obj._bank_type_get(cr, uid, context=context) |
265 | + |
266 | + _columns = { |
267 | + 'bank_state': fields.selection(_bank_type_get, 'Bank Account Type', |
268 | + required=True), |
269 | + } |
270 | + |
271 | + def update_cc_iban(self, cr, uid, ids, context=None): |
272 | + if context is None: |
273 | + context = {} |
274 | + data = self.read(cr, uid, ids, context=context)[0] |
275 | + bank_obj = self.pool['res.partner.bank'] |
276 | + partner_obj = self.pool['res.partner'] |
277 | + partner_ids = context.get('active_ids') |
278 | + if partner_ids: |
279 | + for partner in partner_obj.browse(cr, uid, partner_ids, |
280 | + context=context): |
281 | + if partner.bank_ids: |
282 | + for bank in partner.bank_ids: |
283 | + new_data = {} |
284 | + country = bank.acc_country_id |
285 | + if not country: |
286 | + country = partner.country |
287 | + new_data['country_id'] = country.id |
288 | + if bank.state == data['bank_state']: |
289 | + continue |
290 | + if bank.state == 'bank': |
291 | + iban = self.convert_to_iban(cr, uid, |
292 | + bank.acc_number, |
293 | + country.code, |
294 | + context=context) |
295 | + values = bank_obj.onchange_banco(cr, uid, ids, |
296 | + iban, country.id, |
297 | + 'iban', |
298 | + context=context) |
299 | + new_data.update( |
300 | + {'acc_number': values['value']['acc_number'], |
301 | + 'state': 'iban'}) |
302 | + elif bank.state == 'iban': |
303 | + ccc = self.convert_to_ccc(cr, uid, bank.acc_number, |
304 | + context=context) |
305 | + values = bank_obj.onchange_banco(cr, uid, ids, ccc, |
306 | + country.id, |
307 | + 'bank', |
308 | + context=context) |
309 | + new_data.update( |
310 | + {'acc_number': values['value']['acc_number'], |
311 | + 'state': 'bank'}) |
312 | + if (not bank.bank or not bank.bank_bic) and \ |
313 | + 'bank' in values['value']: |
314 | + bank_data = bank_obj.onchange_bank_id( |
315 | + cr, uid, ids, values['value']['bank'], |
316 | + context=context) |
317 | + new_data.update( |
318 | + {'bank': values['value']['bank'], |
319 | + 'bank_bic': bank_data['value']['bank_bic'], |
320 | + 'bank_name': bank_data['value']['bank_name']}) |
321 | + bank_obj.write(cr, uid, [bank.id], new_data, |
322 | + context=context) |
323 | + return {'type': 'ir.actions.act_window_close'} |
324 | + |
325 | + def convert_to_iban(self, cr, uid, acc_number, country_code, context=None): |
326 | + code_char = _mapping[country_code[:1]] + _mapping[country_code[1:]] |
327 | + ccc = acc_number.replace(" ", "") |
328 | + for key, replacement in _mapping.items(): |
329 | + ccc_number = ccc.replace(key, replacement) |
330 | + ccc_convert = int(ccc_number + code_char + '00') |
331 | + remainder = ccc_convert % 97 |
332 | + control_digit = 98 - remainder |
333 | + if control_digit < 10: |
334 | + control_digit = '0' + str(control_digit) |
335 | + else: |
336 | + control_digit = str(control_digit) |
337 | + iban = _pretty_iban(country_code + control_digit + str(ccc)) |
338 | + return iban |
339 | + |
340 | + def convert_to_ccc(self, cr, uid, acc_number, context=None): |
341 | + ccc = acc_number.replace(" ", "") |
342 | + acc_number = ccc[4:] |
343 | + return "%s %s %s %s" % (acc_number[0:4], acc_number[4:8], |
344 | + acc_number[8:10], acc_number[10:]) |
345 | |
346 | === added file 'l10n_es_iban_converter/wizard/wizard_partner_cc_iban_view.xml' |
347 | --- l10n_es_iban_converter/wizard/wizard_partner_cc_iban_view.xml 1970-01-01 00:00:00 +0000 |
348 | +++ l10n_es_iban_converter/wizard/wizard_partner_cc_iban_view.xml 2014-08-06 11:31:37 +0000 |
349 | @@ -0,0 +1,41 @@ |
350 | +<?xml version="1.0" encoding="UTF-8"?> |
351 | +<openerp> |
352 | + <data> |
353 | + |
354 | + <record id="wizard_partner_cc_iban_view" model="ir.ui.view"> |
355 | + <field name="name">wizard.partner.cc.iban.view</field> |
356 | + <field name="model">wizard.partner.cc.iban</field> |
357 | + <field name="type">form</field> |
358 | + <field name="arch" type="xml"> |
359 | + <form string="Convert CCC <-> IBAN"> |
360 | + <group colspan="4"> |
361 | + <separator colspan="4" /> |
362 | + <label |
363 | + string="You are going to update account number in partners banks, select which type to do you want to change" /> |
364 | + <field name="bank_state" nolabel="1" /> |
365 | + </group> |
366 | + <group colspan="4"> |
367 | + <button icon='gtk-cancel' special="cancel" |
368 | + string="Cancel" /> |
369 | + <button name="update_cc_iban" icon='gtk-ok' |
370 | + type="object" string="Ok" /> |
371 | + </group> |
372 | + </form> |
373 | + </field> |
374 | + </record> |
375 | + |
376 | + <!-- ACTION partner To CC IBAN --> |
377 | + <act_window id="action_partner_to_cciban" key2="client_action_multi" |
378 | + name="Convert CCC <-> IBAN" res_model="wizard.partner.cc.iban" |
379 | + src_model="res.partner" view_id="wizard_partner_cc_iban_view" |
380 | + view_mode="form" target="new" view_type="form" |
381 | + groups="base.group_extended" /> |
382 | + |
383 | + <!-- SHORCUT partner to CC IBAN --> |
384 | + <act_window context="{'active_ids':[active_id]}" id="shorcut_partner_to_cciban" |
385 | + name="Convert CCC <-> IBAN" res_model="wizard.partner.cc.iban" |
386 | + src_model="res.partner" view_type="form" view_mode="form" |
387 | + target="new" /> |
388 | + |
389 | + </data> |
390 | +</openerp> |
391 | \ No newline at end of file |
Some comments inline