Merge lp:~acysos-team/openerp-spain/openerp-spain-6.0 into lp:~openerp-spain-team/openerp-spain/6.0

Proposed by Ignacio Ibeas (www.acysos.com) on 2013-01-07
Status: Merged
Merged at revision: 337
Proposed branch: lp:~acysos-team/openerp-spain/openerp-spain-6.0
Merge into: lp:~openerp-spain-team/openerp-spain/6.0
Diff against target: 2896 lines (+823/-847)
16 files modified
l10n_es_payment_order/__init__.py (+2/-0)
l10n_es_payment_order/__openerp__.py (+12/-2)
l10n_es_payment_order/i18n/es.po (+217/-339)
l10n_es_payment_order/remesas_data.xml (+4/-4)
l10n_es_payment_order/remesas_view.xml (+1/-1)
l10n_es_payment_order/security/ir.model.access.csv (+13/-0)
l10n_es_payment_order/wizard/__init__.py (+10/-0)
l10n_es_payment_order/wizard/converter.py (+83/-90)
l10n_es_payment_order/wizard/csb_19.py (+49/-44)
l10n_es_payment_order/wizard/csb_32.py (+59/-53)
l10n_es_payment_order/wizard/csb_34.py (+79/-74)
l10n_es_payment_order/wizard/csb_34_01.py (+36/-29)
l10n_es_payment_order/wizard/csb_58.py (+44/-38)
l10n_es_payment_order/wizard/export_remesas.py (+129/-173)
l10n_es_payment_order/wizard/export_remesas_view.xml (+40/-0)
l10n_es_payment_order/wizard/log.py (+45/-0)
To merge this branch: bzr merge lp:~acysos-team/openerp-spain/openerp-spain-6.0
Reviewer Review Type Date Requested Status
Ignacio Ibeas (www.acysos.com) Approve on 2013-01-09
Review via email: mp+142078@code.launchpad.net

Commit message

[FIX] l10n_es_payment_order: refactorización, eliminación del código de OpenERP 5.0 y herencia en CSB

Description of the change

Se ha eliminado todo el código que quedaba de OpenERP 5.0 a partir de los
cambios que realizo Pexego en el wizard para OpenERP 6.1. Este cambio hace que
99% del codigo del módulo sea igual para OpenERP 6.0 y 6.1 a diferencia de
una vista que ha cambiado en OpenERP 6.1 pero que solo afecta a una línea
(línea 26 de remesa_view.xml).
El resto del código es exactamente igual para ambas versiones. Esto facilita
mucho el mantenimiento.

Se ha modificado todas las clases de los cuadernos y del converter,
convirtiendolas en clases del OSV y, por lo tanto, permitiendo la herencia de
OpenERP.

To post a comment you must log in.
Joan M. Grande (totaler) wrote :

Genial trabajo. Dos puntualizaciones:

- El objeto "payment.converter.spain" al no tener un reflejo en la base de datos, se le puede poner el atributo "_auto = False" para evitar crear una tabla vacia en postgres.
- Si el código fuera PEP8, ya sería la releche.

338. By Ignacio Ibeas (www.acysos.com) on 2013-01-07

[FIX] l10n_es_payment_order: fix auto = False en el converter

339. By Ignacio Ibeas (www.acysos.com) on 2013-01-07

[FIX] l10n_es_payment_order: fix auto = False en las clases que no necesitan tablas

Hola,

Ya esta añadido el _auto = False a todas las clases que no necesitan tablas.

Respecto a PEP8, tendrá que ser en otra revisión, ahora creo que es urgente tener un módulo que no tenga restos de OpenERP 5.0 y que permita herencia, para el desarrollo de nuevos módulos.

Saludos,
Ignacio Ibeas

Como veo que no hay más comentario procedo a hacer el merge.

Saludos

review: Approve
340. By Ignacio Ibeas (www.acysos.com) on 2013-01-11

Merge: actulizar cambios

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_es_payment_order/__init__.py'
2--- l10n_es_payment_order/__init__.py 2011-08-29 15:11:11 +0000
3+++ l10n_es_payment_order/__init__.py 2013-01-11 10:23:22 +0000
4@@ -7,6 +7,8 @@
5 # Copyright (c) 2008 Pablo Rocandio. All Rights Reserved.
6 # Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
7 # Jordi Esteve <jesteve@zikzakmedia.com>
8+# AvanzOSC, Advanced Open Source Consulting
9+# Copyright (C) 2011-2012 Ainara Galdona (www.avanzosc.com). All Rights Reserved
10 # $Id$
11 #
12 # This program is free software: you can redistribute it and/or modify
13
14=== modified file 'l10n_es_payment_order/__openerp__.py'
15--- l10n_es_payment_order/__openerp__.py 2012-03-03 11:14:30 +0000
16+++ l10n_es_payment_order/__openerp__.py 2013-01-11 10:23:22 +0000
17@@ -7,8 +7,13 @@
18 # Copyright (c) 2008 Acysos SL. All Rights Reserved.
19 # Ignacio Ibeas <ignacio@acysos.com>
20 # Copyright (c) 2008 Pablo Rocandio. All Rights Reserved.
21+# AvanzOSC, Advanced Open Source Consulting
22+# Copyright (C) 2011-2012 Ainara Galdona (www.avanzosc.com). All Rights Reserved
23 # $Id$
24 #
25+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
26+# Ignacio Ibeas <ignacio@acysos.com>
27+#
28 # This program is free software: you can redistribute it and/or modify
29 # it under the terms of the GNU Affero General Public License as published by
30 # the Free Software Foundation, either version 3 of the License, or
31@@ -26,7 +31,7 @@
32
33 {
34 "name" : "Exportación de ficheros bancarios CSB 19, CSB 32, CSB 34 y CSB 58",
35- "version" : "1.5",
36+ "version" : "1.6",
37 "author" : "Acysos SL, Zikzakmedia SL, Pablo Rocandio, NaN·tic",
38 "category" : "Localisation/Accounting",
39 "description" : """Módulo para la exportación de ficheros bancarios según las normas CSB 19 (recibos domiciliados), CBS 32 (descuento comercial), CSB 58 (anticipos de créditos) y CSB 34 (emisión de transferencias, nóminas, cheques, pagarés y pagos certificados) para poder ser enviados a la entidad bancaria.
40@@ -49,7 +54,12 @@
41 "depends" : ["base", "account", "account_payment_extension",],
42 "init_xml" : ["remesas_data.xml"],
43 "demo_xml" : [],
44- "update_xml" : ["remesas_report.xml", "remesas_view.xml", "remesas_wizard.xml",],
45+ "update_xml" : [
46+ "remesas_report.xml",
47+ "remesas_view.xml",
48+ "wizard/export_remesas_view.xml",
49+ "security/ir.model.access.csv"
50+ ],
51 "installable" : True,
52 "active" : False,
53 }
54
55=== modified file 'l10n_es_payment_order/i18n/es.po'
56--- l10n_es_payment_order/i18n/es.po 2011-08-03 15:44:39 +0000
57+++ l10n_es_payment_order/i18n/es.po 2013-01-11 10:23:22 +0000
58@@ -1,67 +1,29 @@
59 # Translation of OpenERP Server.
60 # This file contains the translation of the following modules:
61-# * l10n_ES_remesas
62+# * l10n_es_payment_order
63 #
64 msgid ""
65 msgstr ""
66-"Project-Id-Version: OpenERP Server 5.0.15\n"
67-"Report-Msgid-Bugs-To: support@openerp.com\n"
68-"POT-Creation-Date: 2011-05-24 11:11+0000\n"
69-"PO-Revision-Date: 2011-05-24 13:34+0100\n"
70-"Last-Translator: Jesús Martín <jmartin@zikzakmedia.com>\n"
71+"Project-Id-Version: OpenERP Server 6.1\n"
72+"Report-Msgid-Bugs-To: \n"
73+"POT-Creation-Date: 2012-09-03 00:18+0000\n"
74+"PO-Revision-Date: 2012-09-03 00:18+0000\n"
75+"Last-Translator: <>\n"
76 "Language-Team: \n"
77 "MIME-Version: 1.0\n"
78 "Content-Type: text/plain; charset=UTF-8\n"
79-"Content-Transfer-Encoding: 8bit\n"
80+"Content-Transfer-Encoding: \n"
81 "Plural-Forms: \n"
82
83 #. module: l10n_es_payment_order
84-#: report:remesas.report:0
85-msgid "Matur. date"
86-msgstr "Fecha de vencimiento"
87-
88-#. module: l10n_es_payment_order
89 #: selection:payment.mode,tipo:0
90 msgid "CSB 19"
91 msgstr "CSB 19"
92
93 #. module: l10n_es_payment_order
94-#: model:ir.module.module,description:l10n_es_payment_order.module_meta_information
95-msgid ""
96-"Módulo para la exportación de ficheros bancarios según las normas CSB 19 (recibos domiciliados), CBS 32 (descuento comercial), CSB 58 (anticipos de créditos) y CSB 34 (emisión de transferencias, nóminas, cheques, pagarés y pagos certificados) para poder ser enviados a la entidad bancaria.\n"
97-"\n"
98-"Crea un tipo de pago \"Recibo domiciliado\" con el código RECIBO_CSB. Este código es importante pues permite ejecutar el asistente de creación del fichero de remesas cuando se presiona el botón \"Realizar pagos\" en la orden de pagos o remesa.\n"
99-"\n"
100-"También crea los tipos de pago \"Transferencia\" (TRANSFERENCIA_CSB), \"Pagaré\" (PAGARE_CSB), \"Cheque\" (CHEQUE_CSB), \"Pago certificado\" (PAGO_CERTIFICADO_CSB).\n"
101-"\n"
102-"Antes de generar un fichero bancario CSB habrá que definir un modo de pago que use el tipo de pago anterior y donde se defina la forma de pago (CSB 19, CSB 32, CSB 34 o CSB 58), la compañía que emite el fichero y el sufijo y nombre de compañia a incluir en el fichero.\n"
103-"\n"
104-"Al crear el fichero bancario CSB:\n"
105-"\n"
106-" * Se pueden agrupar o no los pagos de una misma empresa y cuenta bancaria\n"
107-" * El fichero creado se guarda como adjunto de la orden de pagos. Se puede volver a crear el fichero de remesas siempre que sea necesario (puede tener que renombrar el anterior fichero adjunto si tienen el mismo nombre).\n"
108-"\n"
109-"También se proporciona un informe para imprimir un listado de los pagos/cobros de la orden de pago/cobro (remesa).\n"
110-msgstr ""
111-"Módulo para la exportación de ficheros bancarios según las normas CSB 19 (recibos domiciliados), CBS 32 (descuento comercial), CSB 58 (anticipos de créditos) y CSB 34 (emisión de transferencias, nóminas, cheques, pagarés y pagos certificados) para poder ser enviados a la entidad bancaria.\n"
112-"\n"
113-"Crea un tipo de pago \"Recibo domiciliado\" con el código RECIBO_CSB. Este código es importante pues permite ejecutar el asistente de creación del fichero de remesas cuando se presiona el botón \"Realizar pagos\" en la orden de pagos o remesa.\n"
114-"\n"
115-"También crea los tipos de pago \"Transferencia\" (TRANSFERENCIA_CSB), \"Pagaré\" (PAGARE_CSB), \"Cheque\" (CHEQUE_CSB), \"Pago certificado\" (PAGO_CERTIFICADO_CSB).\n"
116-"\n"
117-"Antes de generar un fichero bancario CSB habrá que definir un modo de pago que use el tipo de pago anterior y donde se defina la forma de pago (CSB 19, CSB 32, CSB 34 o CSB 58), la compañía que emite el fichero y el sufijo y nombre de compañia a incluir en el fichero.\n"
118-"\n"
119-"Al crear el fichero bancario CSB:\n"
120-"\n"
121-" * Se pueden agrupar o no los pagos de una misma empresa y cuenta bancaria\n"
122-" * El fichero creado se guarda como adjunto de la orden de pagos. Se puede volver a crear el fichero de remesas siempre que sea necesario (puede tener que renombrar el anterior fichero adjunto si tienen el mismo nombre).\n"
123-"\n"
124-"También se proporciona un informe para imprimir un listado de los pagos/cobros de la orden de pago/cobro (remesa).\n"
125-
126-#. module: l10n_es_payment_order
127-#: help:payment.mode,send_type:0
128-msgid "The sending type of the payment file"
129-msgstr "El tipos de envío del archivo de pago"
130+#: field:payment.mode,send_type:0
131+msgid "Send Type"
132+msgstr "Tipo de envío"
133
134 #. module: l10n_es_payment_order
135 #: field:payment.mode,add_date:0
136@@ -79,14 +41,17 @@
137 msgstr "CIF"
138
139 #. module: l10n_es_payment_order
140+#: view:wizard.payment.file.spain:0
141+msgid "_Export"
142+msgstr "_Exportar"
143+
144+#. module: l10n_es_payment_order
145 #: code:addons/l10n_es_payment_order/wizard/converter.py:71
146 #, python-format
147-msgid ""
148-"Error:\n"
149+msgid "Error:\n"
150 "\n"
151 "Can not convert float number %(number).2f to fit in %(size)d characters."
152-msgstr ""
153-"Error:\n"
154+msgstr "Error:\n"
155 "\n"
156 "No se puede convertir el número %(number).2f para que quepa en %(size)d caracteres."
157
158@@ -111,49 +76,34 @@
159 msgstr "Cedente"
160
161 #. module: l10n_es_payment_order
162-#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:151
163-#, python-format
164-msgid ""
165-"User error:\n"
166-"\n"
167-"The payment mode is not CSB 19, CSB 32, CSB 34 or CSB 58"
168-msgstr ""
169-"Error del usuario:\n"
170-"\n"
171-"El modo de pago no es CSB 19, CSB 32, CSB 34 ni CSB 58"
172-
173-#. module: l10n_es_payment_order
174-#: report:remesas.report:0
175-msgid "Account:"
176-msgstr "C.C.:"
177-
178-#. module: l10n_es_payment_order
179-#: selection:payment.mode,cost_key:0
180-msgid "Expense of the Recipient"
181-msgstr "Gastos por cuenta del beneficiario"
182-
183-#. module: l10n_es_payment_order
184-#: wizard_button:export_payment_file_spain,export,end:0
185-#: wizard_button:export_payment_file_spain,init,export:0
186-msgid "Ok"
187-msgstr "Aceptar"
188-
189-#. module: l10n_es_payment_order
190-#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:140
191-#, python-format
192-msgid ""
193-"User error:\n"
194+#: model:ir.model,name:l10n_es_payment_order.model_wizard_payment_file_export_spain
195+msgid "Pay file export spain"
196+msgstr "Pay file export spain"
197+
198+#. module: l10n_es_payment_order
199+#: model:ir.model,name:l10n_es_payment_order.model_wizard_payment_file_spain
200+msgid "wizard.payment.file.spain"
201+msgstr "wizard.payment.file.spain"
202+
203+#. module: l10n_es_payment_order
204+#: field:payment.mode,not_to_the_order:0
205+msgid "Not to the Order"
206+msgstr "No a la orden"
207+
208+#. module: l10n_es_payment_order
209+#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:129
210+#, python-format
211+msgid "User error:\n"
212 "\n"
213 "The bank account number of the customer %s has not 20 digits."
214-msgstr ""
215-"Error del usuario:\n"
216+msgstr "Error del usuario:\n"
217 "\n"
218 "El número de C.C. del cliente %s no tiene 20 dígitos."
219
220 #. module: l10n_es_payment_order
221-#: wizard_field:export_payment_file_spain,export,pay_fname:0
222+#: field:wizard.payment.file.spain,pay_fname:0
223 msgid "File name"
224-msgstr "Nombre del fichero"
225+msgstr "Nombre Fichero"
226
227 #. module: l10n_es_payment_order
228 #: help:payment.mode,concept:0
229@@ -161,19 +111,14 @@
230 msgstr "Concepto de la orden."
231
232 #. module: l10n_es_payment_order
233-#: model:ir.actions.report.xml,name:l10n_es_payment_order.remesas_report
234-msgid "Remesa"
235-msgstr "Remesa"
236-
237-#. module: l10n_es_payment_order
238 #: field:payment.mode,barred:0
239 msgid "Barred"
240 msgstr "Barrado"
241
242 #. module: l10n_es_payment_order
243-#: field:payment.mode,send_type:0
244-msgid "Send Type"
245-msgstr "Tipo de envío"
246+#: help:payment.mode,send_type:0
247+msgid "The sending type of the payment file"
248+msgstr "El tipos de envío del archivo de pago"
249
250 #. module: l10n_es_payment_order
251 #: help:payment.mode,direct_pay_order:0
252@@ -181,14 +126,12 @@
253 msgstr "Por defecto 'No'."
254
255 #. module: l10n_es_payment_order
256-#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:137
257+#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:126
258 #, python-format
259-msgid ""
260-"User error:\n"
261+msgid "User error:\n"
262 "\n"
263 "The bank account number of the customer %s is not defined and current payment mode enforces all lines to have a bank account."
264-msgstr ""
265-"Error del usuario:\n"
266+msgstr "Error del usuario:\n"
267 "\n"
268 "La empresa %s no tiene definida ninguna cuenta bancaria y la forma de pago actual fuerza que todas las líneas tengan asignada una cuenta bancaria."
269
270@@ -200,12 +143,10 @@
271 #. module: l10n_es_payment_order
272 #: code:addons/l10n_es_payment_order/wizard/converter.py:98
273 #, python-format
274-msgid ""
275-"User error:\n"
276+msgid "User error:\n"
277 "\n"
278 "The bank account number of %s is not defined."
279-msgstr ""
280-"Error del usuario:\n"
281+msgstr "Error del usuario:\n"
282 "\n"
283 "El número de C.C. del cliente %s no existe."
284
285@@ -215,31 +156,19 @@
286 msgstr "Pagaré"
287
288 #. module: l10n_es_payment_order
289-#: report:remesas.report:0
290-msgid "Payment date:"
291-msgstr "Fecha cargo:"
292-
293-#. module: l10n_es_payment_order
294-#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:87
295+#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:73
296 #, python-format
297-msgid ""
298-"User error:\n"
299+msgid "User error:\n"
300 "\n"
301 "The bank account of the company %s is not defined."
302-msgstr ""
303-"Error del usuario:\n"
304+msgstr "Error del usuario:\n"
305 "\n"
306 "No se ha definido el C.C. de la compañía %s."
307
308 #. module: l10n_es_payment_order
309-#: selection:payment.mode,csb34_type:0
310-msgid "Transfer"
311-msgstr "Transferencia"
312-
313-#. module: l10n_es_payment_order
314-#: field:payment.mode,ine:0
315-msgid "INE code"
316-msgstr "Código INE"
317+#: model:payment.type,name:l10n_es_payment_order.payment_type_giro0
318+msgid "Giiro"
319+msgstr "Giro"
320
321 #. module: l10n_es_payment_order
322 #: selection:payment.mode,tipo:0
323@@ -247,6 +176,11 @@
324 msgstr "CSB 32"
325
326 #. module: l10n_es_payment_order
327+#: model:ir.model,name:l10n_es_payment_order.model_wizard_payment_file_join_spain
328+msgid "Pay file join spain"
329+msgstr "Pay file join spain"
330+
331+#. module: l10n_es_payment_order
332 #: selection:payment.mode,tipo:0
333 msgid "CSB 34"
334 msgstr "CSB 34"
335@@ -257,10 +191,9 @@
336 msgstr "Modo de pago"
337
338 #. module: l10n_es_payment_order
339-#: model:payment.type,name:l10n_es_payment_order.payment_type_recibodomiciliado0
340-#: model:payment.type,note:l10n_es_payment_order.payment_type_recibodomiciliado0
341-msgid "Recibo domiciliado"
342-msgstr "Recibo domiciliado"
343+#: selection:payment.mode,csb34_type:0
344+msgid "Certified Payments"
345+msgstr "Pagos certificados"
346
347 #. module: l10n_es_payment_order
348 #: help:payment.mode,alt_domicile_format:0
349@@ -273,19 +206,28 @@
350 msgstr "Datos del presentador"
351
352 #. module: l10n_es_payment_order
353+#: field:payment.mode,csb19_extra_concepts:0
354+msgid "Extra Concepts"
355+msgstr "Conceptos Extra"
356+
357+#. module: l10n_es_payment_order
358 #: selection:payment.mode,tipo:0
359 msgid "None"
360 msgstr "Ninguno"
361
362 #. module: l10n_es_payment_order
363+#: model:payment.type,name:l10n_es_payment_order.payment_type_recibodomiciliado0
364+#: model:payment.type,note:l10n_es_payment_order.payment_type_recibodomiciliado0
365+msgid "Recibo domiciliado"
366+msgstr "Recibo domiciliado"
367+
368+#. module: l10n_es_payment_order
369 #: code:addons/l10n_es_payment_order/wizard/converter.py:101
370 #, python-format
371-msgid ""
372-"User error:\n"
373+msgid "User error:\n"
374 "\n"
375 "The bank account number of %s does not have 20 digits."
376-msgstr ""
377-"Error del usuario:\n"
378+msgstr "Error del usuario:\n"
379 "\n"
380 "El número de C.C. de %s no tiene 20 dígitos."
381
382@@ -309,54 +251,44 @@
383 #: code:addons/l10n_es_payment_order/wizard/csb_32.py:195
384 #: code:addons/l10n_es_payment_order/wizard/csb_32.py:221
385 #, python-format
386-msgid ""
387-"Configuration error:\n"
388+msgid "Configuration error:\n"
389 "\n"
390 "The line \"%s\" is not 150 characters long:\n"
391 "%s"
392-msgstr ""
393-"Error de configuración:\n"
394+msgstr "Error de configuración:\n"
395 "\n"
396 "La línea \"%s\" no tiene 150 caracteres:\n"
397 "%s"
398
399 #. module: l10n_es_payment_order
400-#: field:payment.mode,partner_id:0
401-#: report:remesas.report:0
402-msgid "Partner"
403-msgstr "Empresa"
404-
405-#. module: l10n_es_payment_order
406 #: code:addons/l10n_es_payment_order/wizard/csb_34.py:154
407-#: code:addons/l10n_es_payment_order/wizard/csb_34.py:355
408-#: code:addons/l10n_es_payment_order/wizard/csb_34.py:370
409+#: code:addons/l10n_es_payment_order/wizard/csb_34.py:356
410+#: code:addons/l10n_es_payment_order/wizard/csb_34.py:371
411 #, python-format
412-msgid ""
413-"Configuration error:\n"
414+msgid "Configuration error:\n"
415 "\n"
416 "The line \"%s\" is not 72 characters long:\n"
417 "%s"
418-msgstr ""
419-"Error de configuración:\n"
420+msgstr "Error de configuración:\n"
421 "\n"
422 "La línea \"%s\" no tiene 72 caracteres:\n"
423 "%s"
424
425 #. module: l10n_es_payment_order
426-#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:174
427+#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:160
428 #, python-format
429-msgid ""
430-"Successfully Exported\n"
431+msgid "Successfully Exported\n"
432 "\n"
433 "Summary:\n"
434 " Total amount paid: %.2f\n"
435 " Total Number of Payments: %d\n"
436-msgstr ""
437-"Exportación realizada con éxito\n"
438+""
439+msgstr "Exportación realizada con éxito\n"
440 "\n"
441 "Resumen:\n"
442 " Total importe remesa: %.2f\n"
443 " Total número de recibos: %d\n"
444+""
445
446 #. module: l10n_es_payment_order
447 #: field:payment.mode,text3:0
448@@ -364,14 +296,12 @@
449 msgstr "Línea 3"
450
451 #. module: l10n_es_payment_order
452-#: code:addons/l10n_es_payment_order/wizard/csb_19.py:74
453+#: code:addons/l10n_es_payment_order/wizard/csb_19.py:77
454 #, python-format
455-msgid ""
456-"User error:\n"
457+msgid "User error:\n"
458 "\n"
459 "Fixed date of charge has not been defined."
460-msgstr ""
461-"Error del usuario:\n"
462+msgstr "Error del usuario:\n"
463 "\n"
464 "No se ha definido una fecha fija de cargo."
465
466@@ -381,44 +311,55 @@
467 msgstr "Nombre compañía para archivo"
468
469 #. module: l10n_es_payment_order
470-#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:166
471+#: view:payment.mode:0
472+msgid "CSB 19 Options"
473+msgstr "Opciones CSB 19"
474+
475+#. module: l10n_es_payment_order
476+#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:152
477 #, python-format
478 msgid "remesa"
479 msgstr "remesa"
480
481 #. module: l10n_es_payment_order
482-#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:83
483+#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:69
484 #, python-format
485-msgid ""
486-"User error:\n"
487+msgid "User error:\n"
488 "\n"
489 "Wizard can not generate export file, there are not payment lines."
490-msgstr ""
491-"Error del usuario:\n"
492+msgstr "Error del usuario:\n"
493 "\n"
494 "El asistente no puede generar el archivo de remesas, no existen recibos."
495
496 #. module: l10n_es_payment_order
497+#: view:payment.mode:0
498+msgid "CSB 32 Options"
499+msgstr "Opciones CSB 32"
500+
501+#. module: l10n_es_payment_order
502 #: code:addons/l10n_es_payment_order/wizard/converter.py:80
503 #, python-format
504-msgid ""
505-"Error:\n"
506+msgid "Error:\n"
507 "\n"
508 "Can not convert integer number %(number)d to fit in %(size)d characters."
509-msgstr ""
510-"Error:\n"
511+msgstr "Error:\n"
512 "\n"
513 "No se puede convertir el número entero %(number)d para que quepa en %(size)d caracteres."
514
515 #. module: l10n_es_payment_order
516-#: wizard_field:export_payment_file_spain,export,note:0
517+#: field:wizard.payment.file.spain,note:0
518 msgid "Log"
519-msgstr "Registro"
520+msgstr "Log"
521
522 #. module: l10n_es_payment_order
523-#: report:remesas.report:0
524-msgid "PAYMENT ORDER Num.:"
525-msgstr "REMESA Nº:"
526+#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:140
527+#, python-format
528+msgid "User error:\n"
529+"\n"
530+"The payment mode is not CSB 19, CSB 32, CSB 34 or CSB 58"
531+msgstr "Error del usuario:\n"
532+"\n"
533+"El modo de pago no es CSB 19, CSB 32, CSB 34 ni CSB 58"
534
535 #. module: l10n_es_payment_order
536 #: selection:payment.mode,tipo:0
537@@ -426,41 +367,33 @@
538 msgstr "CSB 58"
539
540 #. module: l10n_es_payment_order
541-#: code:addons/l10n_es_payment_order/remesas.py:107
542+#: code:addons/l10n_es_payment_order/remesas.py:111
543 #, python-format
544 msgid "Dear Sir"
545 msgstr "Estimado Sr."
546
547 #. module: l10n_es_payment_order
548-#: report:remesas.report:0
549-msgid "........."
550-msgstr "........."
551-
552-#. module: l10n_es_payment_order
553-#: model:ir.module.module,shortdesc:l10n_es_payment_order.module_meta_information
554-msgid "Exportación de ficheros bancarios CSB 19, CSB 32, CSB 34 y CSB 58"
555-msgstr "Exportación de ficheros bancarios CSB 19, CSB 32, CSB 34 y CSB 58"
556+#: field:payment.mode,ine:0
557+msgid "INE code"
558+msgstr "Código INE"
559
560 #. module: l10n_es_payment_order
561 #: code:addons/l10n_es_payment_order/wizard/csb_34.py:128
562 #, python-format
563-msgid ""
564-"User error:\n"
565+msgid "User error:\n"
566 "\n"
567 "Company %s has no invoicing or default address."
568-msgstr ""
569-"Error del usuario:\n"
570+msgstr "Error del usuario:\n"
571 "\n"
572 "La compañía %s no tiene dirección por defecto o de facturación."
573
574 #. module: l10n_es_payment_order
575-#: model:payment.type,name:l10n_es_payment_order.payment_type_cheque0
576-#: model:payment.type,note:l10n_es_payment_order.payment_type_cheque0
577-msgid "Cheque"
578-msgstr "Cheque"
579+#: selection:payment.mode,cost_key:0
580+msgid "Expense of the Payer"
581+msgstr "Gastos por cuenta del ordenante"
582
583 #. module: l10n_es_payment_order
584-#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:168
585+#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:154
586 #, python-format
587 msgid "Remesa "
588 msgstr "Remesa "
589@@ -471,11 +404,6 @@
590 msgstr "Clave de gastos"
591
592 #. module: l10n_es_payment_order
593-#: model:ir.model,name:l10n_es_payment_order.model_payment_order
594-msgid "Payment Order"
595-msgstr "Orden de pago"
596-
597-#. module: l10n_es_payment_order
598 #: field:payment.mode,concept:0
599 msgid "Concept of the Order"
600 msgstr "Concepto de la orden."
601@@ -487,6 +415,12 @@
602 msgstr "Transferencia"
603
604 #. module: l10n_es_payment_order
605+#: model:payment.type,name:l10n_es_payment_order.payment_type_cheque0
606+#: model:payment.type,note:l10n_es_payment_order.payment_type_cheque0
607+msgid "Cheque"
608+msgstr "Cheque"
609+
610+#. module: l10n_es_payment_order
611 #: model:payment.type,note:l10n_es_payment_order.payment_type_pagare0
612 msgid "Pagare"
613 msgstr "Pagaré"
614@@ -497,25 +431,14 @@
615 msgstr "Opciones CSB 34"
616
617 #. module: l10n_es_payment_order
618-#: wizard_view:export_payment_file_spain,export:0
619-#: wizard_view:export_payment_file_spain,init:0
620+#: view:wizard.payment.file.spain:0
621 msgid "Payment order export"
622-msgstr "Exportar orden de pago"
623-
624-#. module: l10n_es_payment_order
625-#: report:remesas.report:0
626-msgid "Total payment order:"
627-msgstr "Total Remesa:"
628-
629-#. module: l10n_es_payment_order
630-#: field:payment.mode,payroll_check:0
631-msgid "Payroll Check"
632-msgstr "Cheque nómina"
633-
634-#. module: l10n_es_payment_order
635-#: wizard_field:export_payment_file_spain,init,join:0
636+msgstr "Exportar fichero de pagos"
637+
638+#. module: l10n_es_payment_order
639+#: field:wizard.payment.file.spain,join:0
640 msgid "Join payment lines of the same partner and bank account"
641-msgstr "Fusionar recibos de la misma empresa y cuenta bancaria"
642+msgstr "Unir las líneas de pagos del mismo cliente y cuenta bancaria"
643
644 #. module: l10n_es_payment_order
645 #: field:payment.mode,alt_domicile_format:0
646@@ -533,14 +456,12 @@
647 msgstr "Orden de abono directo"
648
649 #. module: l10n_es_payment_order
650-#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:94
651+#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:80
652 #, python-format
653-msgid ""
654-"User error:\n"
655+msgid "User error:\n"
656 "\n"
657 "The company VAT number related to the bank account of the payment mode is not defined."
658-msgstr ""
659-"Error del usuario:\n"
660+msgstr "Error del usuario:\n"
661 "\n"
662 "No se ha definido el CIF de la compañía asociada al C.C. del modo de pago."
663
664@@ -550,9 +471,9 @@
665 msgstr "Datos adicionales para pagarés, cheques y pagos certificados."
666
667 #. module: l10n_es_payment_order
668-#: report:remesas.report:0
669-msgid "Invoice"
670-msgstr "Factura"
671+#: view:wizard.payment.file.spain:0
672+msgid "Cancel"
673+msgstr "Cancel"
674
675 #. module: l10n_es_payment_order
676 #: field:payment.mode,text1:0
677@@ -565,41 +486,35 @@
678 msgstr "Línea 2"
679
680 #. module: l10n_es_payment_order
681-#: field:payment.mode,not_to_the_order:0
682-msgid "Not to the Order"
683-msgstr "No a la orden"
684-
685-#. module: l10n_es_payment_order
686-#: view:payment.mode:0
687-msgid "CSB 32 Options"
688-msgstr "Opciones CSB 32"
689-
690-#. module: l10n_es_payment_order
691-#: wizard_field:export_payment_file_spain,export,pay:0
692+#: selection:payment.mode,cost_key:0
693+msgid "Expense of the Recipient"
694+msgstr "Gastos por cuenta del beneficiario"
695+
696+#. module: l10n_es_payment_order
697+#: model:payment.type,name:l10n_es_payment_order.payment_type_reposicion0
698+#: model:payment.type,note:l10n_es_payment_order.payment_type_reposicion0
699+msgid "Reposición"
700+msgstr "Reposición"
701+
702+#. module: l10n_es_payment_order
703+#: field:wizard.payment.file.spain,pay:0
704 msgid "Payment order file"
705-msgstr "Archivo remesa"
706-
707-#. module: l10n_es_payment_order
708-#: report:remesas.report:0
709-msgid "Created date:"
710-msgstr "Fecha confección:"
711-
712-#. module: l10n_es_payment_order
713-#: selection:payment.mode,cost_key:0
714-msgid "Expense of the Payer"
715-msgstr "Gastos por cuenta del ordenante"
716+msgstr "Fichero de pagos"
717+
718+#. module: l10n_es_payment_order
719+#: selection:payment.mode,csb34_type:0
720+msgid "Transfer"
721+msgstr "Transferencia"
722
723 #. module: l10n_es_payment_order
724 #: code:addons/l10n_es_payment_order/wizard/csb_34.py:143
725-#: code:addons/l10n_es_payment_order/wizard/csb_34.py:340
726+#: code:addons/l10n_es_payment_order/wizard/csb_34.py:341
727 #, python-format
728-msgid ""
729-"Configuration error:\n"
730+msgid "Configuration error:\n"
731 "\n"
732 "A line in \"%s\" is not 72 characters long:\n"
733 "%s"
734-msgstr ""
735-"Error de configuración:\n"
736+msgstr "Error de configuración:\n"
737 "\n"
738 "Una línea del \"%s\" no tiene 72 caracteres:\n"
739 "%s"
740@@ -610,37 +525,6 @@
741 msgstr "Opciones CSB 58"
742
743 #. module: l10n_es_payment_order
744-#: code:addons/l10n_es_payment_order/wizard/csb_19.py:54
745-#: code:addons/l10n_es_payment_order/wizard/csb_19.py:86
746-#: code:addons/l10n_es_payment_order/wizard/csb_19.py:110
747-#: code:addons/l10n_es_payment_order/wizard/csb_19.py:123
748-#: code:addons/l10n_es_payment_order/wizard/csb_19.py:138
749-#: code:addons/l10n_es_payment_order/wizard/csb_19.py:165
750-#: code:addons/l10n_es_payment_order/wizard/csb_58.py:53
751-#: code:addons/l10n_es_payment_order/wizard/csb_58.py:71
752-#: code:addons/l10n_es_payment_order/wizard/csb_58.py:100
753-#: code:addons/l10n_es_payment_order/wizard/csb_58.py:111
754-#: code:addons/l10n_es_payment_order/wizard/csb_58.py:231
755-#: code:addons/l10n_es_payment_order/wizard/csb_58.py:247
756-#: code:addons/l10n_es_payment_order/wizard/csb_58.py:264
757-#, python-format
758-msgid ""
759-"Configuration error:\n"
760-"\n"
761-"The line \"%s\" is not 162 characters long:\n"
762-"%s"
763-msgstr ""
764-"Error de configuración:\n"
765-"\n"
766-"La línea \"%s\" no tiene 162 caracteres:\n"
767-"%s"
768-
769-#. module: l10n_es_payment_order
770-#: report:remesas.report:0
771-msgid "Bank:"
772-msgstr "Banco:"
773-
774-#. module: l10n_es_payment_order
775 #: selection:payment.mode,csb34_type:0
776 msgid "Promissory Note"
777 msgstr "Pagaré"
778@@ -657,12 +541,12 @@
779 msgstr "Actívelo si desea añadir el tipo de dato 910 con la fecha de pago en el archivo."
780
781 #. module: l10n_es_payment_order
782-#: selection:payment.mode,csb34_type:0
783-msgid "Certified Payments"
784-msgstr "Pagos certificados"
785+#: field:payment.mode,payroll_check:0
786+msgid "Payroll Check"
787+msgstr "Cheque nómina"
788
789 #. module: l10n_es_payment_order
790-#: code:addons/l10n_es_payment_order/remesas.py:109
791+#: code:addons/l10n_es_payment_order/remesas.py:113
792 #, python-format
793 msgid "Total:"
794 msgstr "Total:"
795@@ -683,14 +567,12 @@
796 msgstr "Nómina"
797
798 #. module: l10n_es_payment_order
799-#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:90
800+#: code:addons/l10n_es_payment_order/wizard/export_remesas.py:76
801 #, python-format
802-msgid ""
803-"User error:\n"
804+msgid "User error:\n"
805 "\n"
806 "The bank account number of the company %s has not 20 digits."
807-msgstr ""
808-"Error del usuario:\n"
809+msgstr "Error del usuario:\n"
810 "\n"
811 "El número de C.C. de la compañía %s no tiene 20 dígitos."
812
813@@ -702,23 +584,26 @@
814 #. module: l10n_es_payment_order
815 #: code:addons/l10n_es_payment_order/wizard/csb_34.py:166
816 #, python-format
817-msgid ""
818-"User error:\n"
819+msgid "User error:\n"
820 "\n"
821 "Partner %s has no invoicing or default address."
822-msgstr ""
823-"Error del usuario:\n"
824+msgstr "Error del usuario:\n"
825 "\n"
826 "La compañía %s no tiene dirección por defecto o de facturación."
827
828 #. module: l10n_es_payment_order
829-#: code:addons/l10n_es_payment_order/remesas.py:108
830+#: code:addons/l10n_es_payment_order/remesas.py:112
831 #, python-format
832 msgid "Payment ref."
833 msgstr "Ref. de pago"
834
835 #. module: l10n_es_payment_order
836 #: selection:payment.mode,send_type:0
837+msgid "Certified Mail"
838+msgstr "Correo certificado"
839+
840+#. module: l10n_es_payment_order
841+#: selection:payment.mode,send_type:0
842 msgid "Ordinary Mail"
843 msgstr "Correo ordinario"
844
845@@ -730,50 +615,43 @@
846 msgstr "Introduzca un texto y/o seleccione un campo de la factura para incluirlo como descripción en la carta. Los posibles valores son: ${amount}, ${communication}, {communication2}, {date}, {ml_maturity_date}, {create_date}, {ml_date_created}"
847
848 #. module: l10n_es_payment_order
849-#: model:ir.actions.wizard,name:l10n_es_payment_order.wizard_create_payment_file_spain
850-msgid "Create payment file"
851-msgstr "Crear fichero de pagos"
852-
853-#. module: l10n_es_payment_order
854-#: report:remesas.report:0
855-msgid "Amount"
856-msgstr "Importe"
857-
858-#. module: l10n_es_payment_order
859-#: report:remesas.report:0
860-msgid "Company:"
861-msgstr "Compañía:"
862-
863-#. module: l10n_es_payment_order
864-#: selection:payment.mode,send_type:0
865-msgid "Certified Mail"
866-msgstr "Correo certificado"
867-
868-#. module: l10n_es_payment_order
869-#: report:remesas.report:0
870-msgid "Type:"
871-msgstr "Tipo:"
872-
873-#. module: l10n_es_payment_order
874-#: view:payment.mode:0
875-msgid "CSB 19 Options"
876-msgstr "Opciones CSB 19"
877-
878-#. module: l10n_es_payment_order
879-#: field:payment.mode,csb19_extra_concepts:0
880-msgid "Extra Concepts"
881-msgstr "Conceptos Extra"
882-
883-#~ msgid ""
884-#~ "Check it if you want to add the 015 data type and the text of the letter "
885-#~ "in the file."
886-#~ msgstr ""
887-#~ "Actívelo si desea añadir el tipo de dato 015 y el texto de la carta en el "
888-#~ "archivo."
889-#~ msgid "Date Check"
890-#~ msgstr "Añadir fecha"
891-#~ msgid "Invalid XML for View Architecture!"
892-#~ msgstr "¡XML inválido para la definición de la vista!"
893-#~ msgid "Optional Text for the Letter"
894-#~ msgstr "Texto opcional para añadir a la carta."
895-
896+#: code:addons/l10n_es_payment_order/wizard/csb_19.py:57
897+#: code:addons/l10n_es_payment_order/wizard/csb_19.py:89
898+#: code:addons/l10n_es_payment_order/wizard/csb_19.py:113
899+#: code:addons/l10n_es_payment_order/wizard/csb_19.py:126
900+#: code:addons/l10n_es_payment_order/wizard/csb_19.py:156
901+#: code:addons/l10n_es_payment_order/wizard/csb_19.py:162
902+#: code:addons/l10n_es_payment_order/wizard/csb_19.py:178
903+#: code:addons/l10n_es_payment_order/wizard/csb_19.py:205
904+#: code:addons/l10n_es_payment_order/wizard/csb_58.py:53
905+#: code:addons/l10n_es_payment_order/wizard/csb_58.py:71
906+#: code:addons/l10n_es_payment_order/wizard/csb_58.py:100
907+#: code:addons/l10n_es_payment_order/wizard/csb_58.py:111
908+#: code:addons/l10n_es_payment_order/wizard/csb_58.py:231
909+#: code:addons/l10n_es_payment_order/wizard/csb_58.py:247
910+#: code:addons/l10n_es_payment_order/wizard/csb_58.py:264
911+#, python-format
912+msgid "Configuration error:\n"
913+"\n"
914+"The line \"%s\" is not 162 characters long:\n"
915+"%s"
916+msgstr "Error de configuración:\n"
917+"\n"
918+"La línea \"%s\" no tiene 162 caracteres:\n"
919+"%s"
920+
921+#. module: l10n_es_payment_order
922+#: model:ir.actions.act_window,name:l10n_es_payment_order.action_wizard_payment_file_spain
923+msgid "Create payments file"
924+msgstr "Crear fichero de cobros/pagos"
925+
926+#. module: l10n_es_payment_order
927+#: model:payment.type,name:l10n_es_payment_order.payment_type_convenido0
928+#: model:payment.type,note:l10n_es_payment_order.payment_type_convenido0
929+msgid "Convenido"
930+msgstr "Convenido"
931+
932+#. module: l10n_es_payment_order
933+#: help:payment.mode,csb19_extra_concepts:0
934+msgid "Check it if you want to add the invoice lines to the extra concepts (Max. 15 lines)"
935+msgstr "Chequear si se quiere añadir a las líneas de factura conceptos extra (Máx. 15 líneas)"
936
937=== modified file 'l10n_es_payment_order/remesas_data.xml'
938--- l10n_es_payment_order/remesas_data.xml 2011-10-26 18:26:56 +0000
939+++ l10n_es_payment_order/remesas_data.xml 2013-01-11 10:23:22 +0000
940@@ -10,28 +10,28 @@
941 </record>
942 <record id="payment_type_transferencia0" model="payment.type">
943 <field name="code">TRANSFERENCIA_CSB</field>
944- <field name="name">Transferencia</field>
945+ <field name="name">Transferencia CSB</field>
946 <field eval="[(6,0,[ref('base.bank_normal')])]" name="suitable_bank_types"/>
947 <field name="note">Transferencia</field>
948 <field eval="1" name="active"/>
949 </record>
950 <record id="payment_type_cheque0" model="payment.type">
951 <field name="code">CHEQUE_CSB</field>
952- <field name="name">Cheque</field>
953+ <field name="name">Cheque CSB</field>
954 <field eval="[(6,0,[ref('base.bank_normal')])]" name="suitable_bank_types"/>
955 <field name="note">Cheque</field>
956 <field eval="1" name="active"/>
957 </record>
958 <record id="payment_type_pagare0" model="payment.type">
959 <field name="code">PAGARE_CSB</field>
960- <field name="name">Pagaré</field>
961+ <field name="name">Pagaré CSB</field>
962 <field eval="[(6,0,[ref('base.bank_normal')])]" name="suitable_bank_types"/>
963 <field name="note">Pagare</field>
964 <field eval="1" name="active"/>
965 </record>
966 <record id="payment_type_pago_certificado0" model="payment.type">
967 <field name="code">PAGO_CERTIFICADO_CSB</field>
968- <field name="name">Pago certificado</field>
969+ <field name="name">Pago certificado CSB</field>
970 <field eval="[(6,0,[ref('base.bank_normal')])]" name="suitable_bank_types"/>
971 <field name="note">Pago certificado</field>
972 <field eval="1" name="active"/>
973
974=== modified file 'l10n_es_payment_order/remesas_view.xml'
975--- l10n_es_payment_order/remesas_view.xml 2011-08-03 15:44:39 +0000
976+++ l10n_es_payment_order/remesas_view.xml 2013-01-11 10:23:22 +0000
977@@ -74,8 +74,8 @@
978 </group>
979 </group>
980 <newline/>
981+ </field>
982 </field>
983- </field>
984 </record>
985
986 </data>
987
988=== added directory 'l10n_es_payment_order/security'
989=== added file 'l10n_es_payment_order/security/ir.model.access.csv'
990--- l10n_es_payment_order/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
991+++ l10n_es_payment_order/security/ir.model.access.csv 2013-01-11 10:23:22 +0000
992@@ -0,0 +1,13 @@
993+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
994+access_csb_19,csb.19,model_csb_19,account_payment.group_account_payment,1,1,1,1
995+access_csb_19_user,csb.19.user,model_csb_19,base.group_user,1,0,0,0
996+access_csb_32,csb.32,model_csb_32,account_payment.group_account_payment,1,1,1,1
997+access_csb_32_user,csb.32.user,model_csb_32,base.group_user,1,0,0,0
998+access_csb_34,csb.34,model_csb_34,account_payment.group_account_payment,1,1,1,1
999+access_csb_34_user,csb.34.user,model_csb_34,base.group_user,1,0,0,0
1000+access_csb_3401,csb.3401,model_csb_3401,account_payment.group_account_payment,1,1,1,1
1001+access_csb_3401_user,csb.3401.user,model_csb_3401,base.group_user,1,0,0,0
1002+access_csb_58,csb.58,model_csb_58,account_payment.group_account_payment,1,1,1,1
1003+access_csb_58_user,csb.58.user,model_csb_58,base.group_user,1,0,0,0
1004+access_payment_converter_spain,payment.converter.spain,model_payment_converter_spain,account_payment.group_account_payment,1,1,1,1
1005+access_payment_converter_spain_user,payment.converter.spain,model_payment_converter_spain,base.group_user,1,0,0,0
1006
1007=== modified file 'l10n_es_payment_order/wizard/__init__.py'
1008--- l10n_es_payment_order/wizard/__init__.py 2011-08-29 15:11:11 +0000
1009+++ l10n_es_payment_order/wizard/__init__.py 2013-01-11 10:23:22 +0000
1010@@ -7,7 +7,11 @@
1011 # Copyright (c) 2008 Pablo Rocandio. All Rights Reserved.
1012 # Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
1013 # Jordi Esteve <jesteve@zikzakmedia.com>
1014+# AvanzOSC, Advanced Open Source Consulting
1015+# Copyright (C) 2011-2012 Ainara Galdona (www.avanzosc.com). All Rights Reserved
1016 # $Id$
1017+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
1018+# Ignacio Ibeas <ignacio@acysos.com>
1019 #
1020 # This program is free software: you can redistribute it and/or modify
1021 # it under the terms of the GNU Affero General Public License as published by
1022@@ -25,3 +29,9 @@
1023 ##############################################################################
1024
1025 import export_remesas
1026+import converter
1027+import csb_19
1028+import csb_32
1029+import csb_34
1030+import csb_34_01
1031+import csb_58
1032
1033=== modified file 'l10n_es_payment_order/wizard/converter.py'
1034--- l10n_es_payment_order/wizard/converter.py 2012-05-22 15:31:15 +0000
1035+++ l10n_es_payment_order/wizard/converter.py 2013-01-11 10:23:22 +0000
1036@@ -10,6 +10,8 @@
1037 # Copyright (c) 2009 NaN (http://www.nan-tic.com) All Rights Reserved.
1038 # Albert Cervera i Areny <albert@nan-tic.com>
1039 # $Id$
1040+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
1041+# Ignacio Ibeas <ignacio@acysos.com>
1042 #
1043 # This program is free software: you can redistribute it and/or modify
1044 # it under the terms of the GNU Affero General Public License as published by
1045@@ -26,95 +28,86 @@
1046 #
1047 ##############################################################################
1048
1049+from osv import osv, fields
1050 from tools.translate import _
1051-
1052-def digits_only(cc_in):
1053- """Discards non-numeric chars"""
1054-
1055- cc = ""
1056- for i in cc_in or '':
1057- try:
1058- int(i)
1059- cc += i
1060- except ValueError:
1061- pass
1062- return cc
1063-
1064-def to_ascii(text):
1065- """Converts special characters such as those with accents to their ASCII equivalents"""
1066- old_chars = ['á','é','í','ó','ú','à','è','ì','ò','ù','ä','ë','ï','ö','ü','â','ê','î','ô','û','Á','É','Í','Ú','Ó','À','È','Ì','Ò','Ù','Ä','Ë','Ï','Ö','Ü','Â','Ê','Î','Ô','Û','ñ','Ñ','ç','Ç','ª','º','·','\n']
1067- new_chars = ['a','e','i','o','u','a','e','i','o','u','a','e','i','o','u','a','e','i','o','u','A','E','I','O','U','A','E','I','O','U','A','E','I','O','U','A','E','I','O','U','n','N','c','C','a','o','.',' ']
1068- for old, new in zip(old_chars, new_chars):
1069- text = text.replace(unicode(old,'UTF-8'), new)
1070- return text
1071-
1072-
1073-class Log(Exception):
1074- def __init__(self, content = '', error = False):
1075- self.content = content
1076- self.error = error
1077- def add(self, s, error=True):
1078- self.content = self.content + s
1079- if error:
1080- self.error = error
1081- def __call__(self):
1082- return self.content
1083- def __str__(self):
1084- return self.content
1085-
1086-def convert_text(text, size, justified='left'):
1087- if justified == 'left':
1088- return to_ascii(text)[:size].ljust(size)
1089- else:
1090- return to_ascii(text)[:size].rjust(size)
1091-
1092-def convert_float(cr, number, size, context):
1093- text = str( int( round( number * 100, 0 ) ) )
1094- if len(text) > size:
1095- raise Log(_('Error:\n\nCan not convert float number %(number).2f to fit in %(size)d characters.') % {
1096- 'number': number,
1097- 'size': size
1098- })
1099- return text.zfill(size)
1100-
1101-def convert_int(cr, number, size, context):
1102- text = str( number )
1103- if len(text) > size:
1104- raise Log( _('Error:\n\nCan not convert integer number %(number)d to fit in %(size)d characters.') % {
1105- 'number': number,
1106- 'size': size
1107- })
1108- return text.zfill(size)
1109-
1110-def convert(cr, value, size, context, justified='left'):
1111- if value == False:
1112- return convert_text('', size)
1113- elif isinstance(value, float):
1114- return convert_float(cr, value, size, context)
1115- elif isinstance(value, int):
1116- return convert_int(cr, value, size, context)
1117- else:
1118- return convert_text(value, size, justified)
1119-
1120-def convert_bank_account(cr, value, partner_name, context):
1121- if not isinstance(value, basestring):
1122- raise Log( _('User error:\n\nThe bank account number of %s is not defined.') % partner_name )
1123- ccc = digits_only(value)
1124- if len(ccc) != 20:
1125- raise Log( _('User error:\n\nThe bank account number of %s does not have 20 digits.') % partner_name )
1126- return ccc
1127-
1128-def bank_account_parts(cr, value, partner_name, context):
1129- if not isinstance(value, basestring):
1130- raise Log( _('User error:\n\nThe bank account number of %s is not defined.') % partner_name )
1131- ccc = digits_only(value)
1132- if len(ccc) != 20:
1133- raise Log( _('User error:\n\nThe bank account number of %s does not have 20 digits.') % partner_name )
1134- return {'bank':ccc[:4],
1135- 'office': ccc[4:8],
1136- 'dc': ccc[8:10],
1137- 'account': ccc[10:]}
1138-
1139-
1140-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1141+from log import *
1142+
1143+class payment_converter_spain(osv.osv):
1144+ _name= 'payment.converter.spain'
1145+ _auto = False
1146+
1147+ def digits_only(self, cr, uid, cc_in):
1148+ """Discards non-numeric chars"""
1149+
1150+ cc = ""
1151+ for i in cc_in or '':
1152+ try:
1153+ int(i)
1154+ cc += i
1155+ except ValueError:
1156+ pass
1157+ return cc
1158+
1159+ def to_ascii(self, cr, uid, text):
1160+ """Converts special characters such as those with accents to their ASCII equivalents"""
1161+ old_chars = ['á','é','í','ó','ú','à','è','ì','ò','ù','ä','ë','ï','ö','ü','â','ê','î','ô','û','Á','É','Í','Ú','Ó','À','È','Ì','Ò','Ù','Ä','Ë','Ï','Ö','Ü','Â','Ê','Î','Ô','Û','ñ','Ñ','ç','Ç','ª','º','·','\n']
1162+ new_chars = ['a','e','i','o','u','a','e','i','o','u','a','e','i','o','u','a','e','i','o','u','A','E','I','O','U','A','E','I','O','U','A','E','I','O','U','A','E','I','O','U','n','N','c','C','a','o','.',' ']
1163+ for old, new in zip(old_chars, new_chars):
1164+ text = text.replace(unicode(old,'UTF-8'), new)
1165+ return text
1166+
1167+ def convert_text(self, cr, uid, text, size, justified='left'):
1168+ if justified == 'left':
1169+ return self.to_ascii(cr,uid,text)[:size].ljust(size)
1170+ else:
1171+ return self.to_ascii(cr,uid,text)[:size].rjust(size)
1172+
1173+ def convert_float(self, cr, uid, number, size, context):
1174+ text = str( int( round( number * 100, 0 ) ) )
1175+ if len(text) > size:
1176+ raise Log(_('Error:\n\nCan not convert float number %(number).2f to fit in %(size)d characters.') % {
1177+ 'number': number,
1178+ 'size': size
1179+ })
1180+ return text.zfill(size)
1181+
1182+ def convert_int(self, cr, uid, number, size, context):
1183+ text = str( number )
1184+ if len(text) > size:
1185+ raise Log( _('Error:\n\nCan not convert integer number %(number)d to fit in %(size)d characters.') % {
1186+ 'number': number,
1187+ 'size': size
1188+ })
1189+ return text.zfill(size)
1190+
1191+ def convert(self, cr, uid, value, size, context, justified='left'):
1192+ if value == False:
1193+ return self.convert_text(cr, uid, '', size)
1194+ elif isinstance(value, float):
1195+ return self.convert_float(cr, uid, value, size, context)
1196+ elif isinstance(value, int):
1197+ return self.convert_int(cr, uid, value, size, context)
1198+ else:
1199+ return self.convert_text(cr, uid, value, size, justified)
1200+
1201+ def convert_bank_account(self, cr, uid, value, partner_name, context):
1202+ if not isinstance(value, basestring):
1203+ raise Log( _('User error:\n\nThe bank account number of %s is not defined.') % partner_name )
1204+ ccc = self.digits_only(cr, uid, value)
1205+ if len(ccc) != 20:
1206+ raise Log( _('User error:\n\nThe bank account number of %s does not have 20 digits.') % partner_name )
1207+ return ccc
1208+
1209+ def bank_account_parts(self, cr, uid, value, partner_name, context):
1210+ if not isinstance(value, basestring):
1211+ raise Log( _('User error:\n\nThe bank account number of %s is not defined.') % partner_name )
1212+ ccc = self.digits_only(cr, uid, value)
1213+ if len(ccc) != 20:
1214+ raise Log( _('User error:\n\nThe bank account number of %s does not have 20 digits.') % partner_name )
1215+ return {'bank':ccc[:4],
1216+ 'office': ccc[4:8],
1217+ 'dc': ccc[8:10],
1218+ 'account': ccc[10:]}
1219+
1220+payment_converter_spain()
1221
1222
1223=== modified file 'l10n_es_payment_order/wizard/csb_19.py'
1224--- l10n_es_payment_order/wizard/csb_19.py 2012-06-12 09:33:58 +0000
1225+++ l10n_es_payment_order/wizard/csb_19.py 2013-01-11 10:23:22 +0000
1226@@ -21,6 +21,9 @@
1227 # Añadidos conceptos extras del CSB 19: Acysos S.L. 2011
1228 # Ignacio Ibeas <ignacio@acysos.com>
1229 #
1230+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
1231+# Ignacio Ibeas <ignacio@acysos.com>
1232+#
1233 # This program is free software: you can redistribute it and/or modify
1234 # it under the terms of the GNU Affero General Public License as published by
1235 # the Free Software Foundation, either version 3 of the License, or
1236@@ -36,20 +39,23 @@
1237 #
1238 ##############################################################################
1239
1240+from osv import osv, fields
1241 from datetime import datetime
1242 from tools.translate import _
1243-from converter import *
1244-
1245-
1246-class csb_19:
1247- def _cabecera_presentador_19(self):
1248+from log import *
1249+
1250+class csb_19(osv.osv):
1251+ _name = 'csb.19'
1252+ _auto = False
1253+ def _cabecera_presentador_19(self,cr,uid):
1254+ converter = self.pool.get('payment.converter.spain')
1255 texto = '5180'
1256 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1257 texto += datetime.today().strftime('%d%m%y')
1258 texto += 6*' '
1259- texto += to_ascii(self.order.mode.nombre).ljust(40)
1260+ texto += converter.to_ascii(cr,uid,self.order.mode.nombre).ljust(40)
1261 texto += 20*' '
1262- cc = digits_only(self.order.mode.bank_id.acc_number)
1263+ cc = converter.digits_only(cr,uid,self.order.mode.bank_id.acc_number)
1264 texto += cc[0:8]
1265 texto += 66*' '
1266 texto += '\r\n'
1267@@ -57,7 +63,8 @@
1268 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Cabecera presentador 19', texto), True)
1269 return texto
1270
1271- def _cabecera_ordenante_19(self, recibo=None):
1272+ def _cabecera_ordenante_19(self,cr,uid, recibo=None):
1273+ converter = self.pool.get('payment.converter.spain')
1274 texto = '5380'
1275 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1276 texto += datetime.today().strftime('%d%m%y')
1277@@ -78,8 +85,8 @@
1278 date_cargo = datetime.strptime(self.order.date_scheduled,'%Y-%m-%d')
1279
1280 texto += date_cargo.strftime('%d%m%y')
1281- texto += to_ascii(self.order.mode.nombre).ljust(40)
1282- cc = digits_only(self.order.mode.bank_id.acc_number)
1283+ texto += converter.to_ascii(cr,uid,self.order.mode.nombre).ljust(40)
1284+ cc = converter.digits_only(cr,uid,self.order.mode.bank_id.acc_number)
1285 texto += cc[0:20]
1286 texto += 8*' '
1287 texto += '01'
1288@@ -89,14 +96,15 @@
1289 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Cabecera ordenante 19', texto), True)
1290 return texto
1291
1292- def _individual_obligatorio_19(self, recibo):
1293+ def _individual_obligatorio_19(self,cr,uid, recibo):
1294+ converter = self.pool.get('payment.converter.spain')
1295 texto = '5680'
1296 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1297 texto += str(recibo['name'])[-12:].zfill(12)
1298- nombre = to_ascii(recibo['partner_id'].name)
1299+ nombre = converter.to_ascii(cr,uid,recibo['partner_id'].name)
1300 texto += nombre[0:40].ljust(40)
1301 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
1302- ccc = digits_only(ccc)
1303+ ccc = converter.digits_only(cr,uid,ccc)
1304 texto += str(ccc)[0:20].zfill(20)
1305 importe = int(round(abs(recibo['amount'])*100,0))
1306 texto += str(importe).zfill(10)
1307@@ -104,21 +112,19 @@
1308 concepto = ''
1309 if recibo['communication']:
1310 concepto = recibo['communication']
1311- texto += to_ascii(concepto)[0:48].ljust(48)
1312- # Esto es lo convencional, descripción de 40 caracteres, pero se puede aprovechar los 8 espacios en blanco finales
1313- #texto += to_ascii(concepto)[0:40].ljust(40)
1314- #texto += 8*' '
1315+ texto += converter.to_ascii(cr,uid,concepto)[0:48].ljust(48)
1316 texto += '\r\n'
1317 if len(texto) != 164:
1318 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Individual obligatorio 19', texto), True)
1319 return texto
1320
1321- def _individual_opcional_19(self, recibo):
1322+ def _individual_opcional_19(self,cr,uid, recibo):
1323 """Para poner el segundo texto de comunicación (en lugar de nombre, domicilio y localidad opcional)"""
1324+ converter = self.pool.get('payment.converter.spain')
1325 texto = '5686'
1326 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1327 texto += str(recibo['name'])[-12:].zfill(12)
1328- texto += to_ascii(recibo['communication2'])[0:115].ljust(115)
1329+ texto += converter.to_ascii(cr,uid,recibo['communication2'])[0:115].ljust(115)
1330 texto += '00000' # Campo de código postal ficticio
1331 texto += 14*' '
1332 texto += '\r\n'
1333@@ -126,36 +132,37 @@
1334 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Individual opcional 19', texto), True)
1335 return texto
1336
1337- def _extra_opcional_19(self, recibo):
1338+ def _extra_opcional_19(self,cr,uid, recibo):
1339 """Para poner los 15 conceptos opcional de los registros 5681-5685 utilizando las lineas de facturación (Máximo 15 lineas)"""
1340+ converter = self.pool.get('payment.converter.spain')
1341 res = {}
1342 res['texto'] = ''
1343 res['total_lines'] = 0
1344 counter = 1
1345 registry_counter = 1
1346- lenght = 0
1347+ length = 0
1348 for invoice in recibo['ml_inv_ref']:
1349 if invoice:
1350- lenght += len(invoice.invoice_line)
1351+ length += len(invoice.invoice_line)
1352 for invoice in recibo['ml_inv_ref']:
1353 if invoice:
1354 for invoice_line in invoice.invoice_line:
1355- if counter <= lenght:
1356+ if counter <= length:
1357 if counter <= 15:
1358 if (counter-1)%3 == 0:
1359 res['texto'] += '568'+str(registry_counter)
1360 res['texto'] += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1361 res['texto'] += str(recibo['name']).zfill(12)
1362 price = ' %(#).2f ' % {'#' : invoice_line.price_subtotal}
1363- res['texto'] += to_ascii(invoice_line.name)[0:(40-len(price))].ljust(40-len(price))
1364- res['texto'] += to_ascii(price.replace('.',','))
1365+ res['texto'] += converter.to_ascii(cr,uid,invoice_line.name)[0:(40-len(price))].ljust(40-len(price))
1366+ res['texto'] += converter.to_ascii(cr,uid,price.replace('.',','))
1367 if counter % 3 == 0:
1368 res['texto'] += 14*' '+'\r\n'
1369 res['total_lines'] += 1
1370 if len(res['texto']) != registry_counter*164:
1371 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Individual opcional 19', res['texto']), True)
1372 registry_counter += 1
1373- elif counter == lenght:
1374+ elif counter == length:
1375 res['texto'] += (3-(counter % 3))*40*' '+14*' '+'\r\n'
1376 res['total_lines'] += 1
1377 if len(res['texto']) != registry_counter*164:
1378@@ -163,7 +170,7 @@
1379 counter += 1
1380 return res
1381
1382- def _total_ordenante_19(self):
1383+ def _total_ordenante_19(self,cr,uid):
1384 texto = '5880'
1385 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1386 texto += 72*' '
1387@@ -178,7 +185,7 @@
1388 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Total ordenante 19', texto), True)
1389 return texto
1390
1391- def _total_general_19(self):
1392+ def _total_general_19(self,cr,uid):
1393 texto = '5980'
1394 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1395 texto += 52*' '
1396@@ -206,7 +213,7 @@
1397 return texto
1398
1399
1400- def create_file(self, pool, cr, uid, order, lines, context):
1401+ def create_file(self, cr, uid, order, lines, context):
1402 self.order = order
1403
1404 txt_remesa = ''
1405@@ -216,7 +223,7 @@
1406 self.group_optional_lines = 0
1407 self.group_amount = 0.0
1408
1409- txt_remesa += self._cabecera_presentador_19()
1410+ txt_remesa += self._cabecera_presentador_19(cr,uid)
1411
1412 if order.date_prefered == 'due':
1413 # Tantos ordenantes como pagos
1414@@ -225,48 +232,46 @@
1415 self.group_optional_lines = 0
1416 self.group_amount = 0.0
1417
1418- txt_remesa += self._cabecera_ordenante_19(recibo)
1419- txt_remesa += self._individual_obligatorio_19(recibo)
1420+ txt_remesa += self._cabecera_ordenante_19(cr,uid,recibo)
1421+ txt_remesa += self._individual_obligatorio_19(cr,uid,recibo)
1422 self.total_payments += 1
1423 self.group_payments += 1
1424 self.group_amount += abs( recibo['amount'] )
1425 if order.mode.csb19_extra_concepts:
1426- extra_concepts = self._extra_opcional_19(recibo)
1427+ extra_concepts = self._extra_opcional_19(cr,uid,recibo)
1428 txt_remesa += extra_concepts['texto']
1429 self.total_optional_lines += extra_concepts['total_lines']
1430 self.group_optional_lines += extra_concepts['total_lines']
1431
1432 if recibo['communication2']:
1433- txt_remesa += self._individual_opcional_19(recibo)
1434- #self.num_lineas_opc = self.num_lineas_opc + 1
1435+ txt_remesa += self._individual_opcional_19(cr,uid,recibo)
1436 self.total_optional_lines += 1
1437 self.group_optional_lines += 1
1438- txt_remesa += self._total_ordenante_19()
1439+ txt_remesa += self._total_ordenante_19(cr,uid)
1440 else:
1441 # Sólo un ordenante
1442- txt_remesa += self._cabecera_ordenante_19()
1443+ txt_remesa += self._cabecera_ordenante_19(cr,uid)
1444 self.group_payments = 0
1445 self.group_optional_lines = 0
1446 self.group_amount = 0.0
1447
1448 for recibo in lines:
1449- txt_remesa += self._individual_obligatorio_19(recibo)
1450+ txt_remesa += self._individual_obligatorio_19(cr,uid,recibo)
1451 self.total_payments += 1
1452 self.group_payments += 1
1453 self.group_amount += abs( recibo['amount'] )
1454 if order.mode.csb19_extra_concepts:
1455- extra_concepts = self._extra_opcional_19(recibo)
1456+ extra_concepts = self._extra_opcional_19(cr,uid,recibo)
1457 txt_remesa += extra_concepts['texto']
1458 self.total_optional_lines += extra_concepts['total_lines']
1459 self.group_optional_lines += extra_concepts['total_lines']
1460 if recibo['communication2']:
1461- txt_remesa += self._individual_opcional_19(recibo)
1462+ txt_remesa += self._individual_opcional_19(cr,uid,recibo)
1463 self.total_optional_lines += 1
1464 self.group_optional_lines += 1
1465
1466- txt_remesa += self._total_ordenante_19()
1467+ txt_remesa += self._total_ordenante_19(cr,uid)
1468
1469- txt_remesa += self._total_general_19()
1470+ txt_remesa += self._total_general_19(cr,uid)
1471 return txt_remesa
1472-
1473-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1474+csb_19()
1475\ No newline at end of file
1476
1477=== modified file 'l10n_es_payment_order/wizard/csb_32.py'
1478--- l10n_es_payment_order/wizard/csb_32.py 2011-08-29 15:11:11 +0000
1479+++ l10n_es_payment_order/wizard/csb_32.py 2013-01-11 10:23:22 +0000
1480@@ -18,6 +18,9 @@
1481 # Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 2009
1482 # Jordi Esteve <jesteve@zikzakmedia.com>
1483 #
1484+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
1485+# Ignacio Ibeas <ignacio@acysos.com>
1486+#
1487 # This program is free software: you can redistribute it and/or modify
1488 # it under the terms of the GNU Affero General Public License as published by
1489 # the Free Software Foundation, either version 3 of the License, or
1490@@ -33,20 +36,22 @@
1491 #
1492 ##############################################################################
1493
1494+from osv import osv, fields
1495 from datetime import datetime
1496 from tools.translate import _
1497-from converter import *
1498-
1499-
1500-class csb_32:
1501-
1502- def _cabecera_fichero_32(self):
1503+from log import *
1504+
1505+class csb_32(osv.osv):
1506+ _name = 'csb.32'
1507+ _auto = False
1508+ def _cabecera_fichero_32(self, cr, uid):
1509+ converter = self.pool.get('payment.converter.spain')
1510 texto = '0265'
1511 texto += ' '
1512 texto += datetime.today().strftime('%d%m%y')
1513- texto += digits_only( self.order.reference )[-4:]
1514+ texto += converter.digits_only(cr, uid, self.order.reference )[-4:]
1515 texto += ' '*35
1516- texto += digits_only( self.order.mode.bank_id.acc_number )[:8]
1517+ texto += converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number )[:8]
1518 texto += ' '*6
1519 texto += ' '*61
1520 texto += ' '*24
1521@@ -55,7 +60,8 @@
1522 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Cabecera fichero 32', texto), True)
1523 return texto
1524
1525- def _cabecera_remesa_32(self, cr, context):
1526+ def _cabecera_remesa_32(self, cr, uid, context):
1527+ converter = self.pool.get('payment.converter.spain')
1528 # A:
1529 texto = '1165'
1530 texto += ' '
1531@@ -66,42 +72,43 @@
1532 texto += ' '*12
1533
1534 # C
1535- texto += convert(cr, self.order.mode.cedente, 15, context) # TODO: Identificador del cedente. Qué es?
1536+ texto += converter.convert(cr, uid, self.order.mode.cedente, 15, context) # TODO: Identificador del cedente. Qué es?
1537 texto += '1' # Identificativo de efectos truncados
1538 texto += ' '*21
1539
1540 # D
1541- texto += digits_only( self.order.mode.bank_id.acc_number )
1542- texto += digits_only( self.order.mode.bank_id.acc_number )
1543- texto += digits_only( self.order.mode.bank_id.acc_number )
1544+ texto += converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number )
1545+ texto += converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number )
1546+ texto += converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number )
1547 texto += ' ' + ' '*24
1548 texto += '\r\n'
1549 if len(texto) != 152:
1550 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Cabecera remesa 32', texto), True)
1551 return texto
1552
1553- def _registro_individual_i_32(self, cr, recibo, context):
1554+ def _registro_individual_i_32(self, cr, uid, recibo, context):
1555+ converter = self.pool.get('payment.converter.spain')
1556 # A
1557 texto = '2565'
1558 texto += ' '
1559 # B
1560- texto += convert(cr, self.num_recibos+1, 15, context)
1561+ texto += converter.convert(cr, uid, self.num_recibos+1, 15, context)
1562 texto += datetime.today().strftime('%d%m%y')
1563 texto += '0001'
1564
1565 # C
1566 state = self.order.mode.bank_id.state_id and self.order.mode.bank_id.state_id.code or False
1567- texto += convert(cr, state, 2, context)
1568+ texto += converter.convert(cr, uid, state, 2, context)
1569 texto += ' '*7
1570 texto += ' '
1571
1572 # D
1573- texto += convert(cr, self.order.mode.bank_id.city, 20, context)
1574+ texto += converter.convert(cr, uid, self.order.mode.bank_id.city, 20, context)
1575 texto += ' '
1576
1577 # E
1578 texto += ' '*24
1579- texto += convert(cr, abs(recibo['amount']), 9, context)
1580+ texto += converter.convert(cr, uid, abs(recibo['amount']), 9, context)
1581 texto += ' '*15
1582 texto += datetime.strptime( recibo['ml_maturity_date'], '%Y-%m-%d').strftime('%d%m%y')
1583 texto += ' '*(6+6+1+4+16)
1584@@ -110,13 +117,14 @@
1585 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Registro individual I 32', texto), True)
1586 return texto
1587
1588- def _registro_individual_ii_32(self, cr, recibo, context):
1589+ def _registro_individual_ii_32(self, cr, uid, recibo, context):
1590+ converter = self.pool.get('payment.converter.spain')
1591 # A: Identificacion de la operacion
1592 texto = '2665'
1593 texto += ' '
1594
1595 # B: Datos del efecto
1596- texto += convert(cr, self.num_recibos+1, 15, context)
1597+ texto += converter.convert(cr, uid, self.num_recibos+1, 15, context)
1598 texto += ' '
1599 texto += '2' # Recibo
1600 texto += '000000'
1601@@ -132,42 +140,44 @@
1602 texto += ' '*20
1603
1604 # D: Datos del efecto
1605- texto += convert(cr, self.order.mode.partner_id.name, 34, context)
1606- texto += convert(cr, recibo['partner_id'].name, 34, context)
1607+ texto += converter.convert(cr, uid, self.order.mode.partner_id.name, 34, context)
1608+ texto += converter.convert(cr, uid, recibo['partner_id'].name, 34, context)
1609 texto += ' '*30
1610 texto += '\r\n'
1611 if len(texto) != 152:
1612 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Registro individual II 32', texto), True)
1613 return texto
1614
1615- def _registro_individual_iii_32(self, cr, recibo, context):
1616+ def _registro_individual_iii_32(self, cr, uid, recibo, context):
1617+ converter = self.pool.get('payment.converter.spain')
1618 # A: Identificacion de la operacion
1619 texto = '2765'
1620 texto += ' '
1621
1622 # B: Datos del efecto
1623- texto += convert(cr, self.num_recibos+1, 15, context)
1624+ texto += converter.convert(cr, uid, self.num_recibos+1, 15, context)
1625 texto += ' '
1626- addresses = self.pool.get('res.partner').address_get(self.cr, self.uid, [recibo['partner_id'].id] )
1627+ addresses = self.pool.get('res.partner').address_get(cr, uid, [recibo['partner_id'].id] )
1628 #if not addresses:
1629 # print "NO ADDRESSES"
1630- address = self.pool.get('res.partner.address').browse(self.cr, self.uid, addresses['default'], self.context)
1631- texto += convert( cr, address.street, 34, context )
1632- texto += convert( cr, address.zip, 5, context )
1633- texto += convert( cr, address.city, 20, context )
1634- texto += convert( cr, address.state_id and address.state_id.code or False, 2, context )
1635+ address = self.pool.get('res.partner.address').browse(cr, uid, addresses['default'], context)
1636+ texto += converter.convert( cr, uid, address.street, 34, context )
1637+ texto += converter.convert( cr, uid, address.zip, 5, context )
1638+ texto += converter.convert( cr, uid, address.city, 20, context )
1639+ texto += converter.convert( cr, uid, address.state_id and address.state_id.code or False, 2, context )
1640 texto += '0'*7
1641
1642 # C: Datos del efecto
1643 vat = recibo['partner_id'].vat and recibo['partner_id'].vat[2:] or False
1644- texto += convert(cr, vat, 9, context)
1645+ texto += converter.convert(cr, uid, vat, 9, context)
1646 texto += ' '*50
1647 texto += '\r\n'
1648 if len(texto) != 152:
1649 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Registro individual III 32', texto), True)
1650 return texto
1651
1652- def _registro_fin_remesa_32(self, cr, context):
1653+ def _registro_fin_remesa_32(self, cr, uid, context):
1654+ converter = self.pool.get('payment.converter.spain')
1655 # A: Identificación de la operación
1656 texto = '7165'
1657 texto += ' '
1658@@ -182,20 +192,21 @@
1659
1660 # D: Acumuladores de importe
1661 texto += ' '*10
1662- texto += convert( cr, abs(self.order.total), 10, context )
1663+ texto += converter.convert( cr, uid, abs(self.order.total), 10, context )
1664 texto += ' '*(10+6+7+6+6+6)
1665
1666 # E: Controles de lectura de fichero
1667 texto += ' '*5
1668- texto += convert(cr, (self.num_recibos*3) + 2, 7, context)
1669- texto += convert(cr, self.num_recibos, 6, context)
1670+ texto += converter.convert(cr, uid, (self.num_recibos*3) + 2, 7, context)
1671+ texto += converter.convert(cr, uid, self.num_recibos, 6, context)
1672 texto += ' '*6
1673 texto += '\r\n'
1674 if len(texto) != 152:
1675 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Fin remesa 32', texto), True)
1676 return texto
1677
1678- def _registro_fin_fichero_32(self, cr, context):
1679+ def _registro_fin_fichero_32(self, cr, uid, context):
1680+ converter = self.pool.get('payment.converter.spain')
1681 # A: Identificación de la operación
1682 texto = '9865'
1683 texto += ' '
1684@@ -208,40 +219,35 @@
1685
1686 # D: Acumuladores de importes
1687 texto += ' '*10
1688- texto += convert( cr, abs(self.order.total), 10, context )
1689+ texto += converter.convert( cr, uid, abs(self.order.total), 10, context )
1690 texto += ' '*(10+6+7+6+6+6)
1691
1692 # E: Controles de lectura del fichero
1693 texto += '00001'
1694- texto += convert(cr, (self.num_recibos*3) + 3, 7, context)
1695- texto += convert(cr, self.num_recibos, 6, context)
1696+ texto += converter.convert(cr, uid, (self.num_recibos*3) + 3, 7, context)
1697+ texto += converter.convert(cr, uid, self.num_recibos, 6, context)
1698 texto += ' '*6
1699 texto += '\r\n'
1700 if len(texto) != 152:
1701 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Fin fichero 32', texto), True)
1702 return texto
1703
1704- def create_file(self, pool, cr, uid, order, lines, context):
1705- self.pool = pool
1706- self.cr = cr
1707- self.uid = uid
1708+ def create_file(self, cr, uid, order, lines, context):
1709 self.order = order
1710- self.context = context
1711
1712 txt_remesa = ''
1713 self.num_recibos = 0
1714 self.num_lineas_opc = 0
1715
1716- txt_remesa += self._cabecera_fichero_32()
1717- txt_remesa += self._cabecera_remesa_32(cr, context)
1718+ txt_remesa += self._cabecera_fichero_32(cr,uid)
1719+ txt_remesa += self._cabecera_remesa_32(cr, uid, context)
1720 for recibo in lines:
1721- txt_remesa += self._registro_individual_i_32(cr, recibo, context)
1722- txt_remesa += self._registro_individual_ii_32(cr, recibo, context)
1723- txt_remesa += self._registro_individual_iii_32(cr, recibo, context)
1724+ txt_remesa += self._registro_individual_i_32(cr, uid, recibo, context)
1725+ txt_remesa += self._registro_individual_ii_32(cr, uid, recibo, context)
1726+ txt_remesa += self._registro_individual_iii_32(cr, uid, recibo, context)
1727 self.num_recibos = self.num_recibos + 1
1728- txt_remesa += self._registro_fin_remesa_32(cr, context)
1729- txt_remesa += self._registro_fin_fichero_32(cr, context)
1730+ txt_remesa += self._registro_fin_remesa_32(cr, uid, context)
1731+ txt_remesa += self._registro_fin_fichero_32(cr, uid, context)
1732 return txt_remesa
1733
1734-
1735-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1736+csb_32()
1737
1738=== modified file 'l10n_es_payment_order/wizard/csb_34.py'
1739--- l10n_es_payment_order/wizard/csb_34.py 2011-09-20 06:47:43 +0000
1740+++ l10n_es_payment_order/wizard/csb_34.py 2013-01-11 10:23:22 +0000
1741@@ -20,6 +20,9 @@
1742 # Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 2009
1743 # Jordi Esteve <jesteve@zikzakmedia.com>
1744 #
1745+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
1746+# Ignacio Ibeas <ignacio@acysos.com>
1747+#
1748 # This program is free software: you can redistribute it and/or modify
1749 # it under the terms of the GNU Affero General Public License as published by
1750 # the Free Software Foundation, either version 3 of the License, or
1751@@ -35,21 +38,17 @@
1752 #
1753 ##############################################################################
1754
1755+from osv import osv, fields
1756 from datetime import datetime
1757 from tools.translate import _
1758-from converter import *
1759+from log import *
1760 import time
1761
1762-csb34_code = {
1763- 'transfer': '56',
1764- 'cheques': '57',
1765- 'promissory_note': '58',
1766- 'certified_payments': '59',
1767-}
1768-
1769-class csb_34:
1770-
1771- def get_message(self, recibo, message=None):
1772+class csb_34(osv.osv):
1773+ _name = 'csb.34'
1774+ _auto = False
1775+
1776+ def get_message(self, cr, uid, recibo, message=None):
1777 """
1778 Evaluates an expression and returns its value
1779 @param recibo: Order line data
1780@@ -78,17 +77,19 @@
1781 message = message.replace('${' + field + '}', value)
1782 return message
1783
1784- def _start_34(self, cr, context):
1785- return convert(cr, self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo, 12, context)
1786+ def _start_34(self, cr, uid, context):
1787+ converter = self.pool.get('payment.converter.spain')
1788+ return converter.convert(cr, uid, self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo, 12, context)
1789
1790 def _cabecera_ordenante_34(self, cr, uid, context):
1791+ converter = self.pool.get('payment.converter.spain')
1792 today = datetime.today().strftime('%d%m%y')
1793
1794 text = ''
1795
1796 # Primer tipo
1797 text += '0362'
1798- text += self._start_34(cr, context)
1799+ text += self._start_34(cr, uid, context)
1800 text += 12*' '
1801 text += '001'
1802 text += today
1803@@ -97,24 +98,23 @@
1804 text += planned.strftime('%d%m%y')
1805 else:
1806 text += today
1807- #text += self.convert(self.order.mode.nombre, 40)
1808- text += convert_bank_account(cr, self.order.mode.bank_id.acc_number, self.order.mode.partner_id.name, context)
1809+ text += converter.convert_bank_account(cr, uid, self.order.mode.bank_id.acc_number, self.order.mode.partner_id.name, context)
1810 text += '0'
1811 text += 8*' '
1812 text += '\r\n'
1813
1814 # Segundo Tipo
1815 text += '0362'
1816- text += self._start_34(cr, context)
1817+ text += self._start_34(cr, uid, context)
1818 text += 12*' '
1819 text += '002'
1820- text += convert(cr, self.order.mode.bank_id.partner_id.name, 36, context)
1821+ text += converter.convert(cr, uid, self.order.mode.bank_id.partner_id.name, 36, context)
1822 text += 5*' '
1823 text += '\r\n'
1824
1825 # Tercer Tipo
1826 text += '0362'
1827- text += self._start_34(cr, context)
1828+ text += self._start_34(cr, uid, context)
1829 text += 12*' '
1830 text += '003'
1831 # Direccion
1832@@ -126,17 +126,17 @@
1833 address = self.pool.get('res.partner.address').read(cr, uid, [address_ids.get('default')], ['street','zip','city'], context)[0]
1834 else:
1835 raise Log( _('User error:\n\nCompany %s has no invoicing or default address.') % self.order.mode.bank_id.partner_id.name )
1836- text += convert(cr, address['street'], 36, context)
1837+ text += converter.convert(cr, uid, address['street'], 36, context)
1838 text += 5*' '
1839 text += '\r\n'
1840
1841 # Cuarto Tipo
1842 text += '0362'
1843- text += self._start_34(cr, context)
1844+ text += self._start_34(cr, uid, context)
1845 text += 12*' '
1846 text += '004'
1847- text += convert(cr, address['zip'], 6, context)
1848- text += convert(cr, address['city'], 30, context)
1849+ text += converter.convert(cr, uid, address['zip'], 6, context)
1850+ text += converter.convert(cr, uid, address['city'], 30, context)
1851 text += 5*' '
1852 text += '\r\n'
1853 if len(text)%74 != 0:
1854@@ -145,7 +145,7 @@
1855
1856 def _cabecera_nacionales_34(self, cr, uid, context):
1857 text = '0456'
1858- text += self._start_34(cr, context)
1859+ text += self._start_34(cr, uid, context)
1860 text += 12*' '
1861 text += 3*' '
1862 text += 41*' '
1863@@ -155,7 +155,13 @@
1864 return text
1865
1866 def _detalle_nacionales_34(self, cr, uid, recibo, csb34_type, context):
1867-
1868+ converter = self.pool.get('payment.converter.spain')
1869+ csb34_code = {
1870+ 'transfer': '56',
1871+ 'cheques': '57',
1872+ 'promissory_note': '58',
1873+ 'certified_payments': '59',
1874+ }
1875 address = None
1876 address_ids = self.pool.get('res.partner').address_get(cr, uid, [recibo['partner_id'].id], ['invoice', 'default'])
1877 if address_ids.get('invoice'):
1878@@ -169,17 +175,16 @@
1879 text = ''
1880 text += '06'
1881 text += csb34_code[csb34_type]
1882- text += self._start_34(cr, context)
1883- text += convert(cr, recibo['partner_id'].vat, 12, context)
1884+ text += self._start_34(cr, uid, context)
1885+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1886 text += '010'
1887- text += convert(cr, abs(recibo['amount']), 12, context)
1888- #text += convert_bank_account(cr, recibo['bank_id'].acc_number, recibo['partner_id'].name, context)
1889+ text += converter.convert(cr, uid, abs(recibo['amount']), 12, context)
1890
1891 # Si la orden se emite para transferencia
1892 csb34_type = self.order.mode.csb34_type
1893 if csb34_type == 'transfer':
1894 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
1895- ccc = digits_only(ccc)
1896+ ccc = converter.digits_only(cr, uid, ccc)
1897 text += ccc[:20].zfill(20)
1898 # Si la orden se emite para pagaré, cheque o pago certificado
1899 else:
1900@@ -220,10 +225,10 @@
1901 # Segundo Registro
1902 text += '06'
1903 text += csb34_code[csb34_type]
1904- text += self._start_34(cr, context)
1905- text += convert(cr, recibo['partner_id'].vat, 12, context)
1906+ text += self._start_34(cr, uid, context)
1907+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1908 text += '011'
1909- text += convert(cr, recibo['partner_id'].name, 36, context)
1910+ text += converter.convert(cr, uid, recibo['partner_id'].name, 36, context)
1911 text += 5*' '
1912 text += '\r\n'
1913
1914@@ -236,10 +241,10 @@
1915 for (code, street) in lines:
1916 text += '06'
1917 text += csb34_code[csb34_type]
1918- text += self._start_34(cr, context)
1919- text += convert(cr, recibo['partner_id'].vat, 12, context)
1920+ text += self._start_34(cr, uid, context)
1921+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1922 text += code
1923- text += convert(cr, street, 36, context)
1924+ text += converter.convert(cr, uid, street, 36, context)
1925 text += 5*' '
1926 text += '\r\n'
1927
1928@@ -247,11 +252,11 @@
1929 if address.zip or address.city:
1930 text += '06'
1931 text += csb34_code[csb34_type]
1932- text += self._start_34(cr, context)
1933- text += convert(cr, recibo['partner_id'].vat, 12, context)
1934+ text += self._start_34(cr, uid, context)
1935+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1936 text += '014'
1937- text += convert(cr, address.zip, 6, context)
1938- text += convert(cr, address.city, 30, context)
1939+ text += converter.convert(cr, uid, address.zip, 6, context)
1940+ text += converter.convert(cr, uid, address.city, 30, context)
1941 text += 5*' '
1942 text += '\r\n'
1943
1944@@ -262,13 +267,13 @@
1945 # Sexto Registro
1946 text += '06'
1947 text += csb34_code[csb34_type]
1948- text += self._start_34(cr, context)
1949- text += convert(cr, recibo['partner_id'].vat, 12, context)
1950+ text += self._start_34(cr, uid, context)
1951+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1952 text += '015'
1953 country_code = address.country_id and address.country_id.code or ''
1954 state = address.state_id and address.state_id.name or ''
1955- text += convert(cr, country_code, 2, context)
1956- text += convert(cr, state, 34, context)
1957+ text += converter.convert(cr, uid, country_code, 2, context)
1958+ text += converter.convert(cr, uid, state, 34, context)
1959 text += 5*' '
1960 text += '\r\n'
1961
1962@@ -278,43 +283,43 @@
1963 if self.order.mode.payroll_check:
1964 text += '06'
1965 text += csb34_code[csb34_type]
1966- text += self._start_34(cr, context)
1967- text += convert(cr, recibo['partner_id'].vat, 12, context)
1968+ text += self._start_34(cr, uid, context)
1969+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1970 text += '018'
1971- text += convert(cr, recibo['partner_id'].vat, 36, context)
1972+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 36, context)
1973 text += 5*' '
1974 text += '\r\n'
1975
1976 # Registro ciento uno (registro usados por algunos bancos como texto de la carta)
1977 text += '06'
1978 text += csb34_code[csb34_type]
1979- text += self._start_34(cr, context)
1980- text += convert(cr, recibo['partner_id'].vat, 12, context)
1981+ text += self._start_34(cr, uid, context)
1982+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1983 text += '101'
1984- message = self.get_message(recibo, self.order.mode.text1)
1985- text += convert(cr, message, 36, context)
1986+ message = self.get_message(cr, uid, recibo, self.order.mode.text1)
1987+ text += converter.convert(cr, uid, message, 36, context)
1988 text += 5*' '
1989 text += '\r\n'
1990
1991 # Registro ciento dos (registro usados por algunos bancos como texto de la carta)
1992 text += '06'
1993 text += csb34_code[csb34_type]
1994- text += self._start_34(cr, context)
1995- text += convert(cr, recibo['partner_id'].vat, 12, context)
1996+ text += self._start_34(cr, uid, context)
1997+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1998 text += '102'
1999- message = self.get_message(recibo, self.order.mode.text2)
2000- text += convert(cr, message, 36, context)
2001+ message = self.get_message(cr, uid, recibo, self.order.mode.text2)
2002+ text += converter.convert(cr, uid, message, 36, context)
2003 text += 5*' '
2004 text += '\r\n'
2005
2006 # Registro ciento tres (registro usados por algunos bancos como texto de la carta)
2007 text += '06'
2008 text += csb34_code[csb34_type]
2009- text += self._start_34(cr, context)
2010- text += convert(cr, recibo['partner_id'].vat, 12, context)
2011+ text += self._start_34(cr, uid, context)
2012+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
2013 text += '103'
2014- message = self.get_message(recibo, self.order.mode.text3)
2015- text += convert(cr, message, 36, context)
2016+ message = self.get_message(cr, uid, recibo, self.order.mode.text3)
2017+ text += converter.convert(cr, uid, message, 36, context)
2018 text += 5*' '
2019 text += '\r\n'
2020
2021@@ -330,10 +335,10 @@
2022 message = day+month+year
2023 text += '06'
2024 text += csb34_code[csb34_type]
2025- text += self._start_34(cr, context)
2026- text += convert(cr, recibo['partner_id'].vat, 12, context)
2027+ text += self._start_34(cr, uid, context)
2028+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
2029 text += '910'
2030- text += convert(cr, message, 36, context)
2031+ text += converter.convert(cr, uid, message, 36, context)
2032 text += 5*' '
2033 text += '\r\n'
2034
2035@@ -342,13 +347,14 @@
2036 return text
2037
2038 def _totales_nacionales_34(self, cr, uid, values, context):
2039+ converter = self.pool.get('payment.converter.spain')
2040 text = '0856'
2041- text += self._start_34(cr, context)
2042+ text += self._start_34(cr, uid, context)
2043 text += 12*' '
2044 text += 3*' '
2045- text += convert(cr, self.order.total, 12, context)
2046- text += convert(cr, values[0], 8, context)
2047- text += convert(cr, values[1], 10, context)
2048+ text += converter.convert(cr, uid, self.order.total, 12, context)
2049+ text += converter.convert(cr, uid, values[0], 8, context)
2050+ text += converter.convert(cr, uid, values[1], 10, context)
2051 text += 6*' '
2052 text += 5*' '
2053 text += '\r\n'
2054@@ -357,13 +363,14 @@
2055 return text
2056
2057 def _total_general_34(self, cr, uid, values, context):
2058+ converter = self.pool.get('payment.converter.spain')
2059 text = '0962'
2060- text += self._start_34(cr, context)
2061+ text += self._start_34(cr, uid, context)
2062 text += 12*' '
2063 text += 3*' '
2064- text += convert(cr, self.order.total, 12, context)
2065- text += convert(cr, values[0], 8, context)
2066- text += convert(cr, values[1], 10, context)
2067+ text += converter.convert(cr, uid, self.order.total, 12, context)
2068+ text += converter.convert(cr, uid, values[0], 8, context)
2069+ text += converter.convert(cr, uid, values[1], 10, context)
2070 text += 6*' '
2071 text += 5*' '
2072 text += '\r\n'
2073@@ -371,10 +378,8 @@
2074 raise Log(_('Configuration error:\n\nThe line "%s" is not 72 characters long:\n%s') % ('Total general 34', text), True)
2075 return text
2076
2077- def create_file(self, pool, cr, uid, order, lines, context):
2078- self.pool = pool
2079+ def create_file(self, cr, uid, order, lines, context):
2080 self.order = order
2081- self.context = context
2082
2083 payment_line_count = 0
2084 record_count = 0
2085@@ -394,4 +399,4 @@
2086 file += self._total_general_34(cr, uid, values, context)
2087 return file
2088
2089-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2090+csb_34()
2091
2092=== modified file 'l10n_es_payment_order/wizard/csb_34_01.py'
2093--- l10n_es_payment_order/wizard/csb_34_01.py 2012-05-28 19:13:52 +0000
2094+++ l10n_es_payment_order/wizard/csb_34_01.py 2013-01-11 10:23:22 +0000
2095@@ -23,6 +23,9 @@
2096 # Adaptacion de la norma 34-01 para emision de pagos. Validado para La Caixa: 2012
2097 # Joan M. Grande <totaler@gmail.com>
2098 #
2099+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
2100+# Ignacio Ibeas <ignacio@acysos.com>
2101+#
2102 # This program is free software: you can redistribute it and/or modify
2103 # it under the terms of the GNU Affero General Public License as published by
2104 # the Free Software Foundation, either version 3 of the License, or
2105@@ -38,22 +41,28 @@
2106 #
2107 ##############################################################################
2108
2109+from osv import osv, fields
2110 from datetime import datetime
2111 from tools.translate import _
2112-from converter import *
2113+from log import *
2114
2115-class csb_34_01:
2116- def _start_34(self, cr, context):
2117- return convert(cr, self.order.mode.bank_id.partner_id.vat[2:], 10, context, 'right')
2118+class csb_34_01(osv.osv):
2119+ _name = 'csb.3401'
2120+ _auto = False
2121+
2122+ def _start_34(self, cr, uid, context):
2123+ converter = self.pool.get('payment.converter.spain')
2124+ return converter.convert(cr, uid, self.order.mode.bank_id.partner_id.vat[2:], 10, context, 'right')
2125
2126 def _cabecera_ordenante_34(self, cr, uid, context):
2127+ converter = self.pool.get('payment.converter.spain')
2128 today = datetime.today().strftime('%d%m%y')
2129
2130 text = ''
2131
2132 # Primer tipo
2133 text += '0356'
2134- text += self._start_34(cr, context)
2135+ text += self._start_34(cr, uid, context)
2136 text += '34016'
2137 text += 7*' '
2138 text += '001'
2139@@ -64,7 +73,7 @@
2140 else:
2141 text += today
2142 #text += self.convert(self.order.mode.nombre, 40)
2143- ccc = bank_account_parts(cr, self.order.mode.bank_id.acc_number, self.order.mode.partner_id.name, context)
2144+ ccc = converter.bank_account_parts(cr, uid, self.order.mode.bank_id.acc_number, self.order.mode.partner_id.name, context)
2145 text += ccc['bank']
2146 text += ccc['office']
2147 text += ccc['account']
2148@@ -77,17 +86,17 @@
2149
2150 # Segundo Tipo
2151 text += '0356'
2152- text += self._start_34(cr, context)
2153+ text += self._start_34(cr, uid, context)
2154 text += '34016'
2155 text += 7*' '
2156 text += '002'
2157- text += convert(cr, self.order.mode.bank_id.partner_id.name, 36, context)
2158+ text += converter.convert(cr, uid, self.order.mode.bank_id.partner_id.name, 36, context)
2159 text += 7*' '
2160 text += '\n'
2161
2162 # Tercer Tipo
2163 text += '0356'
2164- text += self._start_34(cr, context)
2165+ text += self._start_34(cr, uid, context)
2166 text += '34016'
2167 text += 7*' '
2168 text += '003'
2169@@ -97,35 +106,34 @@
2170 raise Log( _('User error:\n\nCompany %s has no invoicing address.') % address_id )
2171
2172 street = self.pool.get('res.partner.address').read(cr, uid, [address_id], ['street'], context)[0]['street']
2173- text += convert(cr, street, 36, context)
2174+ text += converter.convert(cr, uid, street, 36, context)
2175 text += 7*' '
2176 text += '\n'
2177
2178 # Cuarto Tipo
2179 text += '0356'
2180- text += self._start_34(cr, context)
2181+ text += self._start_34(cr, uid, context)
2182 text += '34016'
2183 text += 7*' '
2184 text += '004'
2185 city = self.pool.get('res.partner.address').read(cr, uid, [address_id], ['city'], context)[0]['city']
2186- text += convert(cr, city, 36, context)
2187+ text += converter.convert(cr, uid, city, 36, context)
2188 text += 7*' '
2189 text += '\n'
2190 return text
2191
2192 def _detalle_nacionales_34(self, cr, uid, recibo, context):
2193+ converter = self.pool.get('payment.converter.spain')
2194 # Primer Registro
2195 text = ''
2196 text += '0656'
2197- text += self._start_34(cr, context)
2198+ text += self._start_34(cr, uid, context)
2199 if not recibo['partner_id'].vat:
2200 raise Log( _('User error:\n\nCompany %s has no vat.') % recibo['partner_id'].name )
2201- text += convert(cr, recibo['partner_id'].vat[2:], 12, context, 'right')
2202+ text += converter.convert(cr, uid, recibo['partner_id'].vat[2:], 12, context, 'right')
2203 text += '010'
2204- text += convert(cr, recibo['amount'], 12, context)
2205- #text += convert_bank_account(cr, recibo['bank_id'].acc_number, recibo['partner_id'].name, context)
2206- #ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
2207- ccc = bank_account_parts(cr, recibo['bank_id'].acc_number, recibo['partner_id'].name, context)
2208+ text += converter.convert(cr, uid, recibo['amount'], 12, context)
2209+ ccc = converter.bank_account_parts(cr, uid, recibo['bank_id'].acc_number, recibo['partner_id'].name, context)
2210 text += ccc['bank']
2211 text += ccc['office']
2212 text += ccc['account']
2213@@ -138,33 +146,32 @@
2214
2215 # Segundo Registro
2216 text += '0656'
2217- text += self._start_34(cr, context)
2218+ text += self._start_34(cr, uid, context)
2219 if not recibo['partner_id'].vat:
2220 raise Log( _('User error:\n\nCompany %s has no vat.') % recibo['partner_id'].name )
2221- text += convert(cr, recibo['partner_id'].vat[2:], 12, context, 'right')
2222+ text += converter.convert(cr, uid, recibo['partner_id'].vat[2:], 12, context, 'right')
2223 text += '011'
2224- text += convert(cr, recibo['partner_id'].name, 36, context)
2225+ text += converter.convert(cr, uid, recibo['partner_id'].name, 36, context)
2226 text += 7*' '
2227 text += '\n'
2228 return text
2229
2230 def _totales_nacionales_34(self, cr, uid, context):
2231+ converter = self.pool.get('payment.converter.spain')
2232 text = '0856'
2233- text += self._start_34(cr, context)
2234+ text += self._start_34(cr, uid, context)
2235 text += 12*' '
2236 text += 3*' '
2237- text += convert(cr, self.order.total, 12, context)
2238- text += convert(cr, self.payment_line_count, 8, context)
2239- text += convert(cr, self.record_count, 10, context)
2240+ text += converter.convert(cr, uid, self.order.total, 12, context)
2241+ text += converter.convert(cr, uid, self.payment_line_count, 8, context)
2242+ text += converter.convert(cr, uid, self.record_count, 10, context)
2243 text += 6*' '
2244 text += 7*' '
2245 text += '\n'
2246 return text
2247
2248- def create_file(self, pool, cr, uid, order, lines, context):
2249- self.pool = pool
2250+ def create_file(self, cr, uid, order, lines, context):
2251 self.order = order
2252- self.context = context
2253
2254 self.payment_line_count = 0
2255 self.record_count = 0
2256@@ -181,4 +188,4 @@
2257
2258 return file
2259
2260-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2261+csb_34_01()
2262
2263=== modified file 'l10n_es_payment_order/wizard/csb_58.py'
2264--- l10n_es_payment_order/wizard/csb_58.py 2011-08-29 15:11:11 +0000
2265+++ l10n_es_payment_order/wizard/csb_58.py 2013-01-11 10:23:22 +0000
2266@@ -18,6 +18,9 @@
2267 # Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 2009
2268 # Jordi Esteve <jesteve@zikzakmedia.com>
2269 #
2270+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
2271+# Ignacio Ibeas <ignacio@acysos.com>
2272+#
2273 # This program is free software: you can redistribute it and/or modify
2274 # it under the terms of the GNU Affero General Public License as published by
2275 # the Free Software Foundation, either version 3 of the License, or
2276@@ -33,19 +36,24 @@
2277 #
2278 ##############################################################################
2279
2280+from osv import osv, fields
2281 from datetime import datetime
2282 from tools.translate import _
2283-from converter import *
2284+from log import *
2285
2286-class csb_58:
2287- def _cabecera_presentador_58(self):
2288+class csb_58(osv.osv):
2289+ _name = 'csb.58'
2290+ _auto = False
2291+
2292+ def _cabecera_presentador_58(self, cr, uid):
2293+ converter = self.pool.get('payment.converter.spain')
2294 texto = '5170'
2295 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
2296 texto += datetime.today().strftime('%d%m%y')
2297 texto += 6*' '
2298- texto += to_ascii(self.order.mode.nombre).ljust(40)
2299+ texto += converter.to_ascii(cr, uid, self.order.mode.nombre).ljust(40)
2300 texto += 20*' '
2301- cc = digits_only(self.order.mode.bank_id.acc_number)
2302+ cc = converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number)
2303 texto += cc[0:8]
2304 texto += 66*' '
2305 texto += '\r\n'
2306@@ -53,32 +61,34 @@
2307 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Cabecera presentador 58', texto), True)
2308 return texto
2309
2310- def _cabecera_ordenante_58(self):
2311+ def _cabecera_ordenante_58(self, cr, uid):
2312+ converter = self.pool.get('payment.converter.spain')
2313 texto = '5370'
2314 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
2315 texto += datetime.today().strftime('%d%m%y')
2316 texto += 6*' '
2317- texto += to_ascii(self.order.mode.nombre).ljust(40)
2318- cc = digits_only(self.order.mode.bank_id.acc_number)
2319+ texto += converter.to_ascii(cr, uid, self.order.mode.nombre).ljust(40)
2320+ cc = converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number)
2321 texto += cc[0:20]
2322 texto += 8*' '
2323 texto += '06'
2324 texto += 52*' '
2325- texto += self.order.mode.ine and to_ascii(self.order.mode.ine)[:9].zfill(9) or 9*' '
2326+ texto += self.order.mode.ine and converter.to_ascii(cr, uid, self.order.mode.ine)[:9].zfill(9) or 9*' '
2327 texto += 3*' '
2328 texto += '\r\n'
2329 if len(texto) != 164:
2330 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Cabecera ordenante 58', texto), True)
2331 return texto
2332
2333- def _individual_obligatorio_58(self, recibo):
2334+ def _individual_obligatorio_58(self, cr, uid, recibo):
2335+ converter = self.pool.get('payment.converter.spain')
2336 texto = '5670'
2337 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
2338 texto += str(recibo['name'])[-12:].zfill(12)
2339- nombre = to_ascii(recibo['partner_id'].name)
2340+ nombre = converter.to_ascii(cr, uid, recibo['partner_id'].name)
2341 texto += nombre[0:40].ljust(40)
2342 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
2343- ccc = digits_only(ccc)
2344+ ccc = converter.digits_only(cr, uid, ccc)
2345 texto += str(ccc)[0:20].zfill(20)
2346 importe = int(round(abs(recibo['amount'])*100,0))
2347 texto += str(importe).zfill(10)
2348@@ -86,7 +96,7 @@
2349 concepto = ''
2350 if recibo['communication']:
2351 concepto = recibo['communication']
2352- texto += to_ascii(concepto)[0:40].ljust(40)
2353+ texto += converter.to_ascii(cr, uid, concepto)[0:40].ljust(40)
2354 if recibo.get('date'):
2355 date_cargo = datetime.strptime(recibo['date'],'%Y-%m-%d')
2356 elif recibo.get('ml_maturity_date'):
2357@@ -100,19 +110,20 @@
2358 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Individual obligatorio 58', texto), True)
2359 return texto
2360
2361- def _individual_opcional_58(self, recibo):
2362+ def _individual_opcional_58(self, cr, uid, recibo):
2363 """Para poner el segundo texto de comunicación"""
2364+ converter = self.pool.get('payment.converter.spain')
2365 texto = '5671'
2366 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
2367 texto += str(recibo['name'])[-12:].zfill(12)
2368- texto += to_ascii(recibo['communication2'])[0:134].ljust(134)
2369+ texto += converter.to_ascii(cr, uid, recibo['communication2'])[0:134].ljust(134)
2370 texto += '\r\n'
2371 if len(texto) != 164:
2372 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Individual opcional 58', texto), True)
2373 return texto
2374
2375
2376- def _registro_obligatorio_domicilio_58(self, recibo):
2377+ def _registro_obligatorio_domicilio_58(self, cr, uid, recibo):
2378 """
2379 Registro obligatorio domicilio 58 para no domiciliados.
2380
2381@@ -134,7 +145,7 @@
2382 (DDMMAA)
2383 F2 Libre 155 8 Alfanumérico
2384 """
2385-
2386+ converter = self.pool.get('payment.converter.spain')
2387 alt_format = self.order.mode.alt_domicile_format
2388
2389 #
2390@@ -207,10 +218,10 @@
2391 texto = '5676'
2392 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
2393 texto += str(recibo['name'])[-12:].zfill(12)
2394- texto += to_ascii(st)[:40].ljust(40) # Domicilio
2395- texto += to_ascii(city)[:35].ljust(35) # Plaza (ciudad)
2396- texto += to_ascii(zip)[:5].zfill(5) # CP
2397- texto += to_ascii(ord_city)[:38].ljust(38) # Localidad del ordenante (ciudad)
2398+ texto += converter.to_ascii(cr, uid, st)[:40].ljust(40) # Domicilio
2399+ texto += converter.to_ascii(cr, uid, city)[:35].ljust(35) # Plaza (ciudad)
2400+ texto += converter.to_ascii(cr, uid, zip)[:5].zfill(5) # CP
2401+ texto += converter.to_ascii(cr, uid, ord_city)[:38].ljust(38) # Localidad del ordenante (ciudad)
2402 if alt_format:
2403 #
2404 # Si usamos el formato alternativo (basado en FacturaPlus)
2405@@ -223,7 +234,7 @@
2406 texto += date_ct.strftime('%d%m%y') # Fecha crédito
2407 texto += 2*' '
2408 else:
2409- texto += to_ascii(ord_state_code)[:2].zfill(2) # Cod prov del ordenante
2410+ texto += converter.to_ascii(cr, uid, ord_state_code)[:2].zfill(2) # Cod prov del ordenante
2411 texto += date_ct.strftime('%d%m%y') # Fecha crédito
2412 texto += 8*' ' # Libre
2413 texto += '\r\n'
2414@@ -232,7 +243,7 @@
2415 return texto
2416
2417
2418- def _total_ordenante_58(self):
2419+ def _total_ordenante_58(self, cr, uid):
2420 texto = '5870'
2421 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
2422 texto += 72*' '
2423@@ -247,7 +258,7 @@
2424 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Total ordenante 58', texto), True)
2425 return texto
2426
2427- def _total_general_58(self):
2428+ def _total_general_58(self, cr, uid):
2429 texto = '5970'
2430 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
2431 texto += 52*' '
2432@@ -264,39 +275,34 @@
2433 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Total general 58', texto), True)
2434 return texto
2435
2436- def create_file(self, pool, cr, uid, order, lines, context):
2437- self.pool = pool
2438- self.cr = cr
2439- self.uid = uid
2440+ def create_file(self, cr, uid, order, lines, context):
2441 self.order = order
2442- self.context = context
2443
2444 txt_remesa = ''
2445 self.num_recibos = 0
2446 self.num_lineas_opc = 0
2447
2448- txt_remesa += self._cabecera_presentador_58()
2449- txt_remesa += self._cabecera_ordenante_58()
2450+ txt_remesa += self._cabecera_presentador_58(cr, uid)
2451+ txt_remesa += self._cabecera_ordenante_58(cr, uid)
2452
2453 for recibo in lines:
2454- txt_remesa += self._individual_obligatorio_58(recibo)
2455+ txt_remesa += self._individual_obligatorio_58(cr, uid, recibo)
2456 self.num_recibos = self.num_recibos + 1
2457
2458 # Sólo emitimos el registro individual si communication2 contiene texto
2459 if recibo['communication2'] and len(recibo['communication2'].strip()) > 0:
2460- txt_remesa += self._individual_opcional_58(recibo)
2461+ txt_remesa += self._individual_opcional_58(cr, uid, recibo)
2462 self.num_lineas_opc = self.num_lineas_opc + 1
2463
2464 # Para recibos no domiciliados, añadimos el registro obligatorio
2465 # de domicilio (necesario con algunos bancos/cajas).
2466 if self.order.mode.inc_domicile:
2467- txt_remesa += self._registro_obligatorio_domicilio_58(recibo)
2468+ txt_remesa += self._registro_obligatorio_domicilio_58(cr, uid, recibo)
2469 self.num_lineas_opc = self.num_lineas_opc + 1
2470
2471- txt_remesa += self._total_ordenante_58()
2472- txt_remesa += self._total_general_58()
2473+ txt_remesa += self._total_ordenante_58(cr, uid)
2474+ txt_remesa += self._total_general_58(cr, uid)
2475
2476 return txt_remesa
2477
2478-
2479-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2480+csb_58()
2481
2482=== modified file 'l10n_es_payment_order/wizard/export_remesas.py'
2483--- l10n_es_payment_order/wizard/export_remesas.py 2012-05-29 12:23:40 +0000
2484+++ l10n_es_payment_order/wizard/export_remesas.py 2013-01-11 10:23:22 +0000
2485@@ -21,6 +21,12 @@
2486 # Añadidos conceptos extras del CSB 19: Acysos S.L. 2011
2487 # Ignacio Ibeas <ignacio@acysos.com>
2488 #
2489+# Migración de wizard.interface para la 6.1: Pexego Sistemas Informáticos. 2012
2490+# Marta Vázquez Rodríguez <marta@pexego.es>
2491+#
2492+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
2493+# Ignacio Ibeas <ignacio@acysos.com>
2494+#
2495 # This program is free software: you can redistribute it and/or modify
2496 # it under the terms of the GNU Affero General Public License as published by
2497 # the Free Software Foundation, either version 3 of the License, or
2498@@ -36,180 +42,130 @@
2499 #
2500 ##############################################################################
2501
2502-import pooler
2503-import wizard
2504+from osv import osv, fields
2505 import base64
2506 from tools.translate import _
2507-from converter import *
2508-import csb_19
2509-import csb_32
2510-import csb_34
2511-import csb_34_01
2512-import csb_58
2513-
2514-join_form = """<?xml version="1.0"?>
2515-<form string="Payment order export">
2516- <field name="join"/>
2517-</form>"""
2518-
2519-join_fields = {
2520- 'join' : {'string':'Join payment lines of the same partner and bank account', 'type':'boolean'},
2521-}
2522-
2523-export_form = """<?xml version="1.0"?>
2524-<form string="Payment order export">
2525- <field name="pay" filename="pay_fname"/>
2526- <field name="pay_fname" invisible="1"/>
2527- <field name="note" colspan="4" nolabel="1"/>
2528-</form>"""
2529-
2530-export_fields = {
2531- 'pay' : {
2532- 'string':'Payment order file',
2533- 'type':'binary',
2534- 'required': False,
2535- 'readonly':True,
2536- },
2537- 'pay_fname': {'string':'File name', 'type':'char', 'size':64},
2538- 'note' : {'string':'Log', 'type':'text'},
2539-}
2540-
2541-
2542-def _create_payment_file(self, cr, uid, data, context):
2543-
2544- txt_remesa = ''
2545- num_lineas_opc = 0
2546-
2547- try:
2548- pool = pooler.get_pool(cr.dbname)
2549- orden = pool.get('payment.order').browse(cr, uid, data['id'], context)
2550- if not orden.line_ids:
2551- raise Log( _('User error:\n\nWizard can not generate export file, there are not payment lines.'), True )
2552-
2553- # Comprobamos que exista número de C.C. y que tenga 20 dígitos
2554- if not orden.mode.bank_id:
2555- raise Log( _('User error:\n\nThe bank account of the company %s is not defined.') % (orden.mode.partner_id.name), True )
2556- cc = digits_only(orden.mode.bank_id.acc_number)
2557- if len(cc) != 20:
2558- raise Log( _('User error:\n\nThe bank account number of the company %s has not 20 digits.') % (orden.mode.partner_id.name), True)
2559-
2560- # Comprobamos que exista el CIF de la compañía asociada al C.C. del modo de pago
2561- if not orden.mode.bank_id.partner_id.vat:
2562- raise Log(_('User error:\n\nThe company VAT number related to the bank account of the payment mode is not defined.'), True)
2563-
2564- recibos = []
2565- if data['form']['join']:
2566- # Lista con todos los partners+bancos diferentes de la remesa
2567- partner_bank_l = reduce(lambda l, x: x not in l and l.append(x) or l,
2568- [(recibo.partner_id,recibo.bank_id) for recibo in orden.line_ids], [])
2569- # Cómputo de la lista de recibos agrupados por mismo partner+banco.
2570- # Los importes se suman, los textos se concatenan con un espacio en blanco y las fechas se escoge el máximo
2571- for partner,bank in partner_bank_l:
2572- lineas = [recibo for recibo in orden.line_ids if recibo.partner_id==partner and recibo.bank_id==bank]
2573- recibos.append({
2574- 'partner_id': partner,
2575- 'bank_id': bank,
2576- 'name': partner.ref or str(l.partner_id.id),
2577- 'amount': reduce(lambda x, y: x+y, [l.amount for l in lineas], 0),
2578- 'communication': reduce(lambda x, y: x+' '+(y or ''), [l.name+' '+l.communication for l in lineas], ''),
2579- 'communication2': reduce(lambda x, y: x+' '+(y or ''), [l.communication2 for l in lineas], ''),
2580- 'date': max([l.date for l in lineas]),
2581- 'ml_maturity_date': max([l.ml_maturity_date for l in lineas]),
2582- 'create_date': max([l.create_date for l in lineas]),
2583- 'ml_date_created': max([l.ml_date_created for l in lineas]),
2584- 'ml_inv_ref': [l.ml_inv_ref for l in lineas]
2585- })
2586- else:
2587- # Cada línea de pago es un recibo
2588- for l in orden.line_ids:
2589- recibos.append({
2590- 'partner_id': l.partner_id,
2591- 'bank_id': l.bank_id,
2592- 'name': l.partner_id.ref or str(l.partner_id.id),
2593- 'amount': l.amount,
2594- 'communication': l.name+' '+l.communication,
2595- 'communication2': l.communication2,
2596- 'date': l.date,
2597- 'ml_maturity_date': l.ml_maturity_date,
2598- 'create_date': l.create_date,
2599- 'ml_date_created': l.ml_date_created,
2600- 'ml_inv_ref':[l.ml_inv_ref]
2601- })
2602-
2603- if orden.mode.require_bank_account:
2604- for line in recibos:
2605- ccc = line['bank_id'] and line['bank_id'].acc_number or False
2606- if not ccc:
2607- raise Log(_('User error:\n\nThe bank account number of the customer %s is not defined and current payment mode enforces all lines to have a bank account.') % (line['partner_id'].name), True)
2608- ccc = digits_only(ccc)
2609- if len(ccc) != 20:
2610- raise Log(_('User error:\n\nThe bank account number of the customer %s has not 20 digits.') % (line['partner_id'].name), True)
2611-
2612- if orden.mode.tipo == 'csb_19':
2613- csb = csb_19.csb_19()
2614- elif orden.mode.tipo == 'csb_32':
2615- csb = csb_32.csb_32()
2616- elif orden.mode.tipo == 'csb_34':
2617- csb = csb_34.csb_34()
2618- elif orden.mode.tipo == '34_01':
2619- csb = csb_34_01.csb_34_01()
2620- elif orden.mode.tipo == 'csb_58':
2621- csb = csb_58.csb_58()
2622- else:
2623- raise Log(_('User error:\n\nThe payment mode is not CSB 19, CSB 32, CSB 34 or CSB 58'), True)
2624- txt_remesa = csb.create_file(pool, cr, uid, orden, recibos, context)
2625-
2626- except Log, log:
2627- return {
2628- 'note': log(),
2629- 'reference': orden.id,
2630- 'pay': False,
2631- 'state':'failed'
2632- }
2633- else:
2634- # Ensure line breaks use MS-DOS (CRLF) format as standards require.
2635- txt_remesa = txt_remesa.replace('\r\n','\n').replace('\n','\r\n')
2636-
2637- file = base64.encodestring(txt_remesa.encode('utf-8'))
2638- fname = (_('remesa') + '_' + orden.mode.tipo + '_' + orden.reference + '.txt').replace('/','-')
2639- pool.get('ir.attachment').create(cr, uid, {
2640- 'name': _('Remesa ') + orden.mode.tipo + ' ' + orden.reference,
2641- 'datas': file,
2642- 'datas_fname': fname,
2643- 'res_model': 'payment.order',
2644- 'res_id': orden.id,
2645- }, context=context)
2646- log = _("Successfully Exported\n\nSummary:\n Total amount paid: %.2f\n Total Number of Payments: %d\n") % (orden.total, len(recibos))
2647- if orden.state == 'open':
2648- pool.get('payment.order').set_done(cr, uid, [orden.id], context)
2649- return {
2650- 'note': log,
2651- 'reference': orden.id,
2652- 'pay': file,
2653- 'pay_fname': fname,
2654- 'state': 'succeeded',
2655- }
2656-
2657-
2658-class wizard_payment_file_spain(wizard.interface):
2659- states = {
2660- 'init' : {
2661- 'actions' : [],
2662- 'result' : {'type' : 'form',
2663- 'arch' : join_form,
2664- 'fields' : join_fields,
2665- 'state' : [('export', 'Ok','gtk-ok') ]}
2666- },
2667- 'export': {
2668- 'actions' : [_create_payment_file],
2669- 'result' : {'type' : 'form',
2670- 'arch' : export_form,
2671- 'fields' : export_fields,
2672- 'state' : [('end', 'Ok','gtk-ok') ]}
2673- }
2674-
2675+from log import *
2676+
2677+
2678+
2679+class wizard_payment_file_spain(osv.osv_memory):
2680+ _name = 'wizard.payment.file.spain'
2681+ _columns = {
2682+ 'join': fields.boolean('Join payment lines of the same partner and bank account'),
2683+ 'pay': fields.binary('Payment order file', readonly=True),
2684+ 'pay_fname': fields.char('File name', size=64),
2685+ 'note': fields.text('Log')
2686 }
2687-wizard_payment_file_spain('export_payment_file_spain')
2688-
2689-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2690+
2691+ def create_payment_file(self, cr, uid, ids, context):
2692+ converter = self.pool.get('payment.converter.spain')
2693+ txt_remesa = ''
2694+ num_lineas_opc = 0
2695+ form_obj = self.browse(cr, uid, ids)[0]
2696+ try:
2697+ orden = self.pool.get('payment.order').browse(cr, uid, context['active_id'], context)
2698+ if not orden.line_ids:
2699+ raise Log( _('User error:\n\nWizard can not generate export file, there are not payment lines.'), True )
2700+
2701+ # Comprobamos que exista número de C.C. y que tenga 20 dígitos
2702+ if not orden.mode.bank_id:
2703+ raise Log( _('User error:\n\nThe bank account of the company %s is not defined.') % (orden.mode.partner_id.name), True )
2704+ cc = converter.digits_only(cr,uid,orden.mode.bank_id.acc_number)
2705+ if len(cc) != 20:
2706+ raise Log( _('User error:\n\nThe bank account number of the company %s has not 20 digits.') % (orden.mode.partner_id.name), True)
2707+
2708+ # Comprobamos que exista el CIF de la compañía asociada al C.C. del modo de pago
2709+ if not orden.mode.bank_id.partner_id.vat:
2710+ raise Log(_('User error:\n\nThe company VAT number related to the bank account of the payment mode is not defined.'), True)
2711+
2712+ recibos = []
2713+ if form_obj.join:
2714+ # Lista con todos los partners+bancos diferentes de la remesa
2715+ partner_bank_l = reduce(lambda l, x: x not in l and l.append(x) or l,
2716+ [(recibo.partner_id,recibo.bank_id) for recibo in orden.line_ids], [])
2717+ # Cómputo de la lista de recibos agrupados por mismo partner+banco.
2718+ # Los importes se suman, los textos se concatenan con un espacio en blanco y las fechas se escoge el máximo
2719+ for partner,bank in partner_bank_l:
2720+ lineas = [recibo for recibo in orden.line_ids if recibo.partner_id==partner and recibo.bank_id==bank]
2721+ recibos.append({
2722+ 'partner_id': partner,
2723+ 'bank_id': bank,
2724+ 'name': partner.ref or str(l.partner_id.id),
2725+ 'amount': reduce(lambda x, y: x+y, [l.amount for l in lineas], 0),
2726+ 'communication': reduce(lambda x, y: x+' '+(y or ''), [l.name+' '+l.communication for l in lineas], ''),
2727+ 'communication2': reduce(lambda x, y: x+' '+(y or ''), [l.communication2 for l in lineas], ''),
2728+ 'date': max([l.date for l in lineas]),
2729+ 'ml_maturity_date': max([l.ml_maturity_date for l in lineas]),
2730+ 'create_date': max([l.create_date for l in lineas]),
2731+ 'ml_date_created': max([l.ml_date_created for l in lineas]),
2732+ 'ml_inv_ref': [l.ml_inv_ref for l in lineas]
2733+ })
2734+ else:
2735+ # Cada línea de pago es un recibo
2736+ for l in orden.line_ids:
2737+ recibos.append({
2738+ 'partner_id': l.partner_id,
2739+ 'bank_id': l.bank_id,
2740+ 'name': l.partner_id.ref or str(l.partner_id.id),
2741+ 'amount': l.amount,
2742+ 'communication': l.name+' '+l.communication,
2743+ 'communication2': l.communication2,
2744+ 'date': l.date,
2745+ 'ml_maturity_date': l.ml_maturity_date,
2746+ 'create_date': l.create_date,
2747+ 'ml_date_created': l.ml_date_created,
2748+ 'ml_inv_ref':[l.ml_inv_ref]
2749+ })
2750+
2751+ if orden.mode.require_bank_account:
2752+ for line in recibos:
2753+ ccc = line['bank_id'] and line['bank_id'].acc_number or False
2754+ if not ccc:
2755+ raise Log(_('User error:\n\nThe bank account number of the customer %s is not defined and current payment mode enforces all lines to have a bank account.') % (line['partner_id'].name), True)
2756+ ccc = converter.digits_only(cr,uid,ccc)
2757+ if len(ccc) != 20:
2758+ raise Log(_('User error:\n\nThe bank account number of the customer %s has not 20 digits.') % (line['partner_id'].name), True)
2759+
2760+ if orden.mode.tipo == 'csb_19':
2761+ csb = self.pool.get('csb.19')
2762+ elif orden.mode.tipo == 'csb_32':
2763+ csb = self.pool.get('csb.32')
2764+ elif orden.mode.tipo == 'csb_34':
2765+ csb = self.pool.get('csb.34')
2766+ elif orden.mode.tipo == '34_01':
2767+ csb = self.pool.get('csb.3401')
2768+ elif orden.mode.tipo == 'csb_58':
2769+ csb = self.pool.get('csb.58')
2770+ else:
2771+ raise Log(_('User error:\n\nThe payment mode is not CSB 19, CSB 32, CSB 34 or CSB 58'), True)
2772+ txt_remesa = csb.create_file(cr, uid, orden, recibos, context)
2773+
2774+ except Log, log:
2775+ form_obj.write({'note': log,'pay': False})
2776+ return True
2777+
2778+ else:
2779+ # Ensure line breaks use MS-DOS (CRLF) format as standards require.
2780+ txt_remesa = txt_remesa.replace('\r\n','\n').replace('\n','\r\n')
2781+
2782+ file = base64.encodestring(txt_remesa.encode('utf-8'))
2783+ fname = (_('remesa') + '_' + orden.mode.tipo + '_' + orden.reference + '.txt').replace('/','-')
2784+ self.pool.get('ir.attachment').create(cr, uid, {
2785+ 'name': _('Remesa ') + orden.mode.tipo + ' ' + orden.reference,
2786+ 'datas': file,
2787+ 'datas_fname': fname,
2788+ 'res_model': 'payment.order',
2789+ 'res_id': orden.id,
2790+ }, context=context)
2791+ log = _("Successfully Exported\n\nSummary:\n Total amount paid: %.2f\n Total Number of Payments: %d\n") % (orden.total, len(recibos))
2792+ self.pool.get('payment.order').set_done(cr, uid, [orden.id], context)
2793+
2794+ form_obj.write({'note': log,'pay': file,'pay_fname': fname})
2795+
2796+ return True
2797+wizard_payment_file_spain()
2798+
2799+
2800+
2801
2802
2803=== added file 'l10n_es_payment_order/wizard/export_remesas_view.xml'
2804--- l10n_es_payment_order/wizard/export_remesas_view.xml 1970-01-01 00:00:00 +0000
2805+++ l10n_es_payment_order/wizard/export_remesas_view.xml 2013-01-11 10:23:22 +0000
2806@@ -0,0 +1,40 @@
2807+<?xml version="1.0" encoding="UTF-8"?>
2808+<openerp>
2809+ <data>
2810+ <record id="view_wizard_payment_file_spain_form" model="ir.ui.view">
2811+ <field name="name">wizard.payment.file.spain.form</field>
2812+ <field name="model">wizard.payment.file.spain</field>
2813+ <field name="type">form</field>
2814+ <field name="arch" type="xml">
2815+ <form string="Payment order export">
2816+ <field name="join"/>
2817+ <field name="pay" filename="pay_fname"/>
2818+ <field name="pay_fname" invisible="1"/>
2819+ <field name="note" colspan="4" nolabel="1"/>
2820+ <separator string="" colspan="4" />
2821+ <group colspan="4" col="6">
2822+ <button icon="gtk-cancel" special="cancel" string="Cancel"/>
2823+ <button icon="gtk-execute" string="_Export" name="create_payment_file" type="object"/>
2824+ </group>
2825+ </form>
2826+ </field>
2827+ </record>
2828+
2829+ <record id="action_wizard_payment_file_spain" model="ir.actions.act_window">
2830+ <field name="name">Create payments file</field>
2831+ <field name="res_model">wizard.payment.file.spain</field>
2832+ <field name="view_type">form</field>
2833+ <field name="view_mode">tree,form</field>
2834+ <field name="view_id" ref="view_wizard_payment_file_spain_form"/>
2835+ <field name="target">new</field>
2836+ </record>
2837+ <record id="action_wizard_payment_file_spain2" model="ir.values">
2838+ <field name="object" eval="1" />
2839+ <field name="name">Create payments file</field>
2840+ <field name="key2">client_action_multi</field>
2841+ <field name="value" eval="'ir.actions.act_window,' + str(ref('action_wizard_payment_file_spain'))"/>
2842+ <field name="key">action</field>
2843+ <field name="model">payment.order</field>
2844+ </record>
2845+ </data>
2846+</openerp>
2847
2848=== added file 'l10n_es_payment_order/wizard/log.py'
2849--- l10n_es_payment_order/wizard/log.py 1970-01-01 00:00:00 +0000
2850+++ l10n_es_payment_order/wizard/log.py 2013-01-11 10:23:22 +0000
2851@@ -0,0 +1,45 @@
2852+# -*- coding: utf-8 -*-
2853+##############################################################################
2854+#
2855+# OpenERP, Open Source Management Solution
2856+# Copyright (c) 2006 ACYSOS S.L. (http://acysos.com) All Rights Reserved.
2857+# Pedro Tarrafeta <pedro@acysos.com>
2858+# Copyright (c) 2008 Pablo Rocandio. All Rights Reserved.
2859+# Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
2860+# Jordi Esteve <jesteve@zikzakmedia.com>
2861+# Copyright (c) 2009 NaN (http://www.nan-tic.com) All Rights Reserved.
2862+# Albert Cervera i Areny <albert@nan-tic.com>
2863+# $Id$
2864+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
2865+# Ignacio Ibeas <ignacio@acysos.com>
2866+#
2867+# This program is free software: you can redistribute it and/or modify
2868+# it under the terms of the GNU Affero General Public License as published by
2869+# the Free Software Foundation, either version 3 of the License, or
2870+# (at your option) any later version.
2871+#
2872+# This program is distributed in the hope that it will be useful,
2873+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2874+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2875+# GNU Affero General Public License for more details.
2876+#
2877+# You should have received a copy of the GNU Affero General Public License
2878+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2879+#
2880+##############################################################################
2881+
2882+from tools.translate import _
2883+
2884+class Log(Exception):
2885+ def __init__(self, content = '', error = False):
2886+ self.content = content
2887+ self.error = error
2888+ def add(self, s, error=True):
2889+ self.content = self.content + s
2890+ if error:
2891+ self.error = error
2892+ def __call__(self):
2893+ return self.content
2894+ def __str__(self):
2895+ return self.content
2896+