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

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.1
Merge into: lp:~openerp-spain-team/openerp-spain/6.1
Diff against target: 1709 lines (+441/-353)
13 files modified
l10n_es_payment_order/__openerp__.py (+6/-3)
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 (+8/-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 (+17/-20)
l10n_es_payment_order/wizard/export_remesas_view.xml (+1/-1)
l10n_es_payment_order/wizard/log.py (+45/-0)
To merge this branch: bzr merge lp:~acysos-team/openerp-spain/openerp-spain-6.1
Reviewer Review Type Date Requested Status
Ignacio Ibeas (www.acysos.com) Approve on 2013-01-09
Review via email: mp+142080@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 código 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,
convirtiéndolas en clases del OSV y, por lo tanto, permitiendo la herencia de
OpenERP.

To post a comment you must log in.
336. 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

Se han realizado los mismo cambios que se han comentado en el merge para la versión 6.0.

Como no ha habido más comentarios, procedo a hacer el merge.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_es_payment_order/__openerp__.py'
2--- l10n_es_payment_order/__openerp__.py 2012-11-15 16:29:52 +0000
3+++ l10n_es_payment_order/__openerp__.py 2013-01-07 16:37:28 +0000
4@@ -11,6 +11,9 @@
5 # Copyright (C) 2011-2012 Ainara Galdona (www.avanzosc.com). All Rights Reserved
6 # $Id$
7 #
8+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
9+# Ignacio Ibeas <ignacio@acysos.com>
10+#
11 # This program is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU Affero General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14@@ -28,7 +31,7 @@
15
16 {
17 "name" : "Exportación de ficheros bancarios CSB 19, CSB 32, CSB 34 y CSB 58",
18- "version" : "1.5",
19+ "version" : "1.6",
20 "author" : "Acysos SL, Zikzakmedia SL, Pablo Rocandio, NaN·tic",
21 "category" : "Localisation/Accounting",
22 "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.
23@@ -54,8 +57,8 @@
24 "update_xml" : [
25 "remesas_report.xml",
26 "remesas_view.xml",
27- #"remesas_wizard.xml",
28- "wizard/export_remesas_view.xml"
29+ "wizard/export_remesas_view.xml",
30+ "security/ir.model.access.csv"
31 ],
32 "installable" : True,
33 "active" : False,
34
35=== modified file 'l10n_es_payment_order/remesas_view.xml'
36--- l10n_es_payment_order/remesas_view.xml 2012-11-15 16:29:52 +0000
37+++ l10n_es_payment_order/remesas_view.xml 2013-01-07 16:37:28 +0000
38@@ -23,7 +23,7 @@
39 <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
40 <field name="arch" type="xml">
41 <field name="bank_id" position="replace"/>
42- <field name="partner_id" position="replace"/>
43+ <field name="partner_id" position="replace"/>
44 <field name="company_id" position="after">
45 <field name="tipo"/>
46 <newline/>
47
48=== added directory 'l10n_es_payment_order/security'
49=== added file 'l10n_es_payment_order/security/ir.model.access.csv'
50--- l10n_es_payment_order/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
51+++ l10n_es_payment_order/security/ir.model.access.csv 2013-01-07 16:37:28 +0000
52@@ -0,0 +1,13 @@
53+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
54+access_csb_19,csb.19,model_csb_19,account_payment.group_account_payment,1,1,1,1
55+access_csb_19_user,csb.19.user,model_csb_19,base.group_user,1,0,0,0
56+access_csb_32,csb.32,model_csb_32,account_payment.group_account_payment,1,1,1,1
57+access_csb_32_user,csb.32.user,model_csb_32,base.group_user,1,0,0,0
58+access_csb_34,csb.34,model_csb_34,account_payment.group_account_payment,1,1,1,1
59+access_csb_34_user,csb.34.user,model_csb_34,base.group_user,1,0,0,0
60+access_csb_3401,csb.3401,model_csb_3401,account_payment.group_account_payment,1,1,1,1
61+access_csb_3401_user,csb.3401.user,model_csb_3401,base.group_user,1,0,0,0
62+access_csb_58,csb.58,model_csb_58,account_payment.group_account_payment,1,1,1,1
63+access_csb_58_user,csb.58.user,model_csb_58,base.group_user,1,0,0,0
64+access_payment_converter_spain,payment.converter.spain,model_payment_converter_spain,account_payment.group_account_payment,1,1,1,1
65+access_payment_converter_spain_user,payment.converter.spain,model_payment_converter_spain,base.group_user,1,0,0,0
66
67=== modified file 'l10n_es_payment_order/wizard/__init__.py'
68--- l10n_es_payment_order/wizard/__init__.py 2012-11-15 16:29:52 +0000
69+++ l10n_es_payment_order/wizard/__init__.py 2013-01-07 16:37:28 +0000
70@@ -10,6 +10,8 @@
71 # AvanzOSC, Advanced Open Source Consulting
72 # Copyright (C) 2011-2012 Ainara Galdona (www.avanzosc.com). All Rights Reserved
73 # $Id$
74+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
75+# Ignacio Ibeas <ignacio@acysos.com>
76 #
77 # This program is free software: you can redistribute it and/or modify
78 # it under the terms of the GNU Affero General Public License as published by
79@@ -27,3 +29,9 @@
80 ##############################################################################
81
82 import export_remesas
83+import converter
84+import csb_19
85+import csb_32
86+import csb_34
87+import csb_34_01
88+import csb_58
89
90=== modified file 'l10n_es_payment_order/wizard/converter.py'
91--- l10n_es_payment_order/wizard/converter.py 2012-05-22 15:31:15 +0000
92+++ l10n_es_payment_order/wizard/converter.py 2013-01-07 16:37:28 +0000
93@@ -10,6 +10,8 @@
94 # Copyright (c) 2009 NaN (http://www.nan-tic.com) All Rights Reserved.
95 # Albert Cervera i Areny <albert@nan-tic.com>
96 # $Id$
97+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
98+# Ignacio Ibeas <ignacio@acysos.com>
99 #
100 # This program is free software: you can redistribute it and/or modify
101 # it under the terms of the GNU Affero General Public License as published by
102@@ -26,95 +28,86 @@
103 #
104 ##############################################################################
105
106+from osv import osv, fields
107 from tools.translate import _
108-
109-def digits_only(cc_in):
110- """Discards non-numeric chars"""
111-
112- cc = ""
113- for i in cc_in or '':
114- try:
115- int(i)
116- cc += i
117- except ValueError:
118- pass
119- return cc
120-
121-def to_ascii(text):
122- """Converts special characters such as those with accents to their ASCII equivalents"""
123- old_chars = ['á','é','í','ó','ú','à','è','ì','ò','ù','ä','ë','ï','ö','ü','â','ê','î','ô','û','Á','É','Í','Ú','Ó','À','È','Ì','Ò','Ù','Ä','Ë','Ï','Ö','Ü','Â','Ê','Î','Ô','Û','ñ','Ñ','ç','Ç','ª','º','·','\n']
124- 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','.',' ']
125- for old, new in zip(old_chars, new_chars):
126- text = text.replace(unicode(old,'UTF-8'), new)
127- return text
128-
129-
130-class Log(Exception):
131- def __init__(self, content = '', error = False):
132- self.content = content
133- self.error = error
134- def add(self, s, error=True):
135- self.content = self.content + s
136- if error:
137- self.error = error
138- def __call__(self):
139- return self.content
140- def __str__(self):
141- return self.content
142-
143-def convert_text(text, size, justified='left'):
144- if justified == 'left':
145- return to_ascii(text)[:size].ljust(size)
146- else:
147- return to_ascii(text)[:size].rjust(size)
148-
149-def convert_float(cr, number, size, context):
150- text = str( int( round( number * 100, 0 ) ) )
151- if len(text) > size:
152- raise Log(_('Error:\n\nCan not convert float number %(number).2f to fit in %(size)d characters.') % {
153- 'number': number,
154- 'size': size
155- })
156- return text.zfill(size)
157-
158-def convert_int(cr, number, size, context):
159- text = str( number )
160- if len(text) > size:
161- raise Log( _('Error:\n\nCan not convert integer number %(number)d to fit in %(size)d characters.') % {
162- 'number': number,
163- 'size': size
164- })
165- return text.zfill(size)
166-
167-def convert(cr, value, size, context, justified='left'):
168- if value == False:
169- return convert_text('', size)
170- elif isinstance(value, float):
171- return convert_float(cr, value, size, context)
172- elif isinstance(value, int):
173- return convert_int(cr, value, size, context)
174- else:
175- return convert_text(value, size, justified)
176-
177-def convert_bank_account(cr, value, partner_name, context):
178- if not isinstance(value, basestring):
179- raise Log( _('User error:\n\nThe bank account number of %s is not defined.') % partner_name )
180- ccc = digits_only(value)
181- if len(ccc) != 20:
182- raise Log( _('User error:\n\nThe bank account number of %s does not have 20 digits.') % partner_name )
183- return ccc
184-
185-def bank_account_parts(cr, value, partner_name, context):
186- if not isinstance(value, basestring):
187- raise Log( _('User error:\n\nThe bank account number of %s is not defined.') % partner_name )
188- ccc = digits_only(value)
189- if len(ccc) != 20:
190- raise Log( _('User error:\n\nThe bank account number of %s does not have 20 digits.') % partner_name )
191- return {'bank':ccc[:4],
192- 'office': ccc[4:8],
193- 'dc': ccc[8:10],
194- 'account': ccc[10:]}
195-
196-
197-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
198+from log import *
199+
200+class payment_converter_spain(osv.osv):
201+ _name= 'payment.converter.spain'
202+ _auto = False
203+
204+ def digits_only(self, cr, uid, cc_in):
205+ """Discards non-numeric chars"""
206+
207+ cc = ""
208+ for i in cc_in or '':
209+ try:
210+ int(i)
211+ cc += i
212+ except ValueError:
213+ pass
214+ return cc
215+
216+ def to_ascii(self, cr, uid, text):
217+ """Converts special characters such as those with accents to their ASCII equivalents"""
218+ old_chars = ['á','é','í','ó','ú','à','è','ì','ò','ù','ä','ë','ï','ö','ü','â','ê','î','ô','û','Á','É','Í','Ú','Ó','À','È','Ì','Ò','Ù','Ä','Ë','Ï','Ö','Ü','Â','Ê','Î','Ô','Û','ñ','Ñ','ç','Ç','ª','º','·','\n']
219+ 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','.',' ']
220+ for old, new in zip(old_chars, new_chars):
221+ text = text.replace(unicode(old,'UTF-8'), new)
222+ return text
223+
224+ def convert_text(self, cr, uid, text, size, justified='left'):
225+ if justified == 'left':
226+ return self.to_ascii(cr,uid,text)[:size].ljust(size)
227+ else:
228+ return self.to_ascii(cr,uid,text)[:size].rjust(size)
229+
230+ def convert_float(self, cr, uid, number, size, context):
231+ text = str( int( round( number * 100, 0 ) ) )
232+ if len(text) > size:
233+ raise Log(_('Error:\n\nCan not convert float number %(number).2f to fit in %(size)d characters.') % {
234+ 'number': number,
235+ 'size': size
236+ })
237+ return text.zfill(size)
238+
239+ def convert_int(self, cr, uid, number, size, context):
240+ text = str( number )
241+ if len(text) > size:
242+ raise Log( _('Error:\n\nCan not convert integer number %(number)d to fit in %(size)d characters.') % {
243+ 'number': number,
244+ 'size': size
245+ })
246+ return text.zfill(size)
247+
248+ def convert(self, cr, uid, value, size, context, justified='left'):
249+ if value == False:
250+ return self.convert_text(cr, uid, '', size)
251+ elif isinstance(value, float):
252+ return self.convert_float(cr, uid, value, size, context)
253+ elif isinstance(value, int):
254+ return self.convert_int(cr, uid, value, size, context)
255+ else:
256+ return self.convert_text(cr, uid, value, size, justified)
257+
258+ def convert_bank_account(self, cr, uid, value, partner_name, context):
259+ if not isinstance(value, basestring):
260+ raise Log( _('User error:\n\nThe bank account number of %s is not defined.') % partner_name )
261+ ccc = self.digits_only(cr, uid, value)
262+ if len(ccc) != 20:
263+ raise Log( _('User error:\n\nThe bank account number of %s does not have 20 digits.') % partner_name )
264+ return ccc
265+
266+ def bank_account_parts(self, cr, uid, value, partner_name, context):
267+ if not isinstance(value, basestring):
268+ raise Log( _('User error:\n\nThe bank account number of %s is not defined.') % partner_name )
269+ ccc = self.digits_only(cr, uid, value)
270+ if len(ccc) != 20:
271+ raise Log( _('User error:\n\nThe bank account number of %s does not have 20 digits.') % partner_name )
272+ return {'bank':ccc[:4],
273+ 'office': ccc[4:8],
274+ 'dc': ccc[8:10],
275+ 'account': ccc[10:]}
276+
277+payment_converter_spain()
278
279
280=== modified file 'l10n_es_payment_order/wizard/csb_19.py'
281--- l10n_es_payment_order/wizard/csb_19.py 2012-09-08 15:32:47 +0000
282+++ l10n_es_payment_order/wizard/csb_19.py 2013-01-07 16:37:28 +0000
283@@ -21,6 +21,9 @@
284 # Añadidos conceptos extras del CSB 19: Acysos S.L. 2011
285 # Ignacio Ibeas <ignacio@acysos.com>
286 #
287+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
288+# Ignacio Ibeas <ignacio@acysos.com>
289+#
290 # This program is free software: you can redistribute it and/or modify
291 # it under the terms of the GNU Affero General Public License as published by
292 # the Free Software Foundation, either version 3 of the License, or
293@@ -36,20 +39,23 @@
294 #
295 ##############################################################################
296
297+from osv import osv, fields
298 from datetime import datetime
299 from tools.translate import _
300-from converter import *
301-
302-
303-class csb_19:
304- def _cabecera_presentador_19(self):
305+from log import *
306+
307+class csb_19(osv.osv):
308+ _name = 'csb.19'
309+ _auto = False
310+ def _cabecera_presentador_19(self,cr,uid):
311+ converter = self.pool.get('payment.converter.spain')
312 texto = '5180'
313 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
314 texto += datetime.today().strftime('%d%m%y')
315 texto += 6*' '
316- texto += to_ascii(self.order.mode.nombre).ljust(40)
317+ texto += converter.to_ascii(cr,uid,self.order.mode.nombre).ljust(40)
318 texto += 20*' '
319- cc = digits_only(self.order.mode.bank_id.acc_number)
320+ cc = converter.digits_only(cr,uid,self.order.mode.bank_id.acc_number)
321 texto += cc[0:8]
322 texto += 66*' '
323 texto += '\r\n'
324@@ -57,7 +63,8 @@
325 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Cabecera presentador 19', texto), True)
326 return texto
327
328- def _cabecera_ordenante_19(self, recibo=None):
329+ def _cabecera_ordenante_19(self,cr,uid, recibo=None):
330+ converter = self.pool.get('payment.converter.spain')
331 texto = '5380'
332 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
333 texto += datetime.today().strftime('%d%m%y')
334@@ -78,8 +85,8 @@
335 date_cargo = datetime.strptime(self.order.date_scheduled,'%Y-%m-%d')
336
337 texto += date_cargo.strftime('%d%m%y')
338- texto += to_ascii(self.order.mode.nombre).ljust(40)
339- cc = digits_only(self.order.mode.bank_id.acc_number)
340+ texto += converter.to_ascii(cr,uid,self.order.mode.nombre).ljust(40)
341+ cc = converter.digits_only(cr,uid,self.order.mode.bank_id.acc_number)
342 texto += cc[0:20]
343 texto += 8*' '
344 texto += '01'
345@@ -89,14 +96,15 @@
346 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Cabecera ordenante 19', texto), True)
347 return texto
348
349- def _individual_obligatorio_19(self, recibo):
350+ def _individual_obligatorio_19(self,cr,uid, recibo):
351+ converter = self.pool.get('payment.converter.spain')
352 texto = '5680'
353 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
354 texto += str(recibo['name'])[-12:].zfill(12)
355- nombre = to_ascii(recibo['partner_id'].name)
356+ nombre = converter.to_ascii(cr,uid,recibo['partner_id'].name)
357 texto += nombre[0:40].ljust(40)
358 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
359- ccc = digits_only(ccc)
360+ ccc = converter.digits_only(cr,uid,ccc)
361 texto += str(ccc)[0:20].zfill(20)
362 importe = int(round(abs(recibo['amount'])*100,0))
363 texto += str(importe).zfill(10)
364@@ -104,21 +112,19 @@
365 concepto = ''
366 if recibo['communication']:
367 concepto = recibo['communication']
368- texto += to_ascii(concepto)[0:48].ljust(48)
369- # Esto es lo convencional, descripción de 40 caracteres, pero se puede aprovechar los 8 espacios en blanco finales
370- #texto += to_ascii(concepto)[0:40].ljust(40)
371- #texto += 8*' '
372+ texto += converter.to_ascii(cr,uid,concepto)[0:48].ljust(48)
373 texto += '\r\n'
374 if len(texto) != 164:
375 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Individual obligatorio 19', texto), True)
376 return texto
377
378- def _individual_opcional_19(self, recibo):
379+ def _individual_opcional_19(self,cr,uid, recibo):
380 """Para poner el segundo texto de comunicación (en lugar de nombre, domicilio y localidad opcional)"""
381+ converter = self.pool.get('payment.converter.spain')
382 texto = '5686'
383 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
384 texto += str(recibo['name'])[-12:].zfill(12)
385- texto += to_ascii(recibo['communication2'])[0:115].ljust(115)
386+ texto += converter.to_ascii(cr,uid,recibo['communication2'])[0:115].ljust(115)
387 texto += '00000' # Campo de código postal ficticio
388 texto += 14*' '
389 texto += '\r\n'
390@@ -126,36 +132,37 @@
391 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Individual opcional 19', texto), True)
392 return texto
393
394- def _extra_opcional_19(self, recibo):
395+ def _extra_opcional_19(self,cr,uid, recibo):
396 """Para poner los 15 conceptos opcional de los registros 5681-5685 utilizando las lineas de facturación (Máximo 15 lineas)"""
397+ converter = self.pool.get('payment.converter.spain')
398 res = {}
399 res['texto'] = ''
400 res['total_lines'] = 0
401 counter = 1
402 registry_counter = 1
403- lenght = 0
404+ length = 0
405 for invoice in recibo['ml_inv_ref']:
406 if invoice:
407- lenght += len(invoice.invoice_line)
408+ length += len(invoice.invoice_line)
409 for invoice in recibo['ml_inv_ref']:
410 if invoice:
411 for invoice_line in invoice.invoice_line:
412- if counter <= lenght:
413+ if counter <= length:
414 if counter <= 15:
415 if (counter-1)%3 == 0:
416 res['texto'] += '568'+str(registry_counter)
417 res['texto'] += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
418 res['texto'] += str(recibo['name']).zfill(12)
419 price = ' %(#).2f ' % {'#' : invoice_line.price_subtotal}
420- res['texto'] += to_ascii(invoice_line.name)[0:(40-len(price))].ljust(40-len(price))
421- res['texto'] += to_ascii(price.replace('.',','))
422+ res['texto'] += converter.to_ascii(cr,uid,invoice_line.name)[0:(40-len(price))].ljust(40-len(price))
423+ res['texto'] += converter.to_ascii(cr,uid,price.replace('.',','))
424 if counter % 3 == 0:
425 res['texto'] += 14*' '+'\r\n'
426 res['total_lines'] += 1
427 if len(res['texto']) != registry_counter*164:
428 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Individual opcional 19', res['texto']), True)
429 registry_counter += 1
430- elif counter == lenght:
431+ elif counter == length:
432 res['texto'] += (3-(counter % 3))*40*' '+14*' '+'\r\n'
433 res['total_lines'] += 1
434 if len(res['texto']) != registry_counter*164:
435@@ -163,7 +170,7 @@
436 counter += 1
437 return res
438
439- def _total_ordenante_19(self):
440+ def _total_ordenante_19(self,cr,uid):
441 texto = '5880'
442 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
443 texto += 72*' '
444@@ -178,7 +185,7 @@
445 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Total ordenante 19', texto), True)
446 return texto
447
448- def _total_general_19(self):
449+ def _total_general_19(self,cr,uid):
450 texto = '5980'
451 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
452 texto += 52*' '
453@@ -206,7 +213,7 @@
454 return texto
455
456
457- def create_file(self, pool, cr, uid, order, lines, context):
458+ def create_file(self, cr, uid, order, lines, context):
459 self.order = order
460
461 txt_remesa = ''
462@@ -216,7 +223,7 @@
463 self.group_optional_lines = 0
464 self.group_amount = 0.0
465
466- txt_remesa += self._cabecera_presentador_19()
467+ txt_remesa += self._cabecera_presentador_19(cr,uid)
468
469 if order.date_prefered == 'due':
470 # Tantos ordenantes como pagos
471@@ -225,48 +232,46 @@
472 self.group_optional_lines = 0
473 self.group_amount = 0.0
474
475- txt_remesa += self._cabecera_ordenante_19(recibo)
476- txt_remesa += self._individual_obligatorio_19(recibo)
477+ txt_remesa += self._cabecera_ordenante_19(cr,uid,recibo)
478+ txt_remesa += self._individual_obligatorio_19(cr,uid,recibo)
479 self.total_payments += 1
480 self.group_payments += 1
481 self.group_amount += abs( recibo['amount'] )
482 if order.mode.csb19_extra_concepts:
483- extra_concepts = self._extra_opcional_19(recibo)
484+ extra_concepts = self._extra_opcional_19(cr,uid,recibo)
485 txt_remesa += extra_concepts['texto']
486 self.total_optional_lines += extra_concepts['total_lines']
487 self.group_optional_lines += extra_concepts['total_lines']
488
489 if recibo['communication2']:
490- txt_remesa += self._individual_opcional_19(recibo)
491- #self.num_lineas_opc = self.num_lineas_opc + 1
492+ txt_remesa += self._individual_opcional_19(cr,uid,recibo)
493 self.total_optional_lines += 1
494 self.group_optional_lines += 1
495- txt_remesa += self._total_ordenante_19()
496+ txt_remesa += self._total_ordenante_19(cr,uid)
497 else:
498 # Sólo un ordenante
499- txt_remesa += self._cabecera_ordenante_19()
500+ txt_remesa += self._cabecera_ordenante_19(cr,uid)
501 self.group_payments = 0
502 self.group_optional_lines = 0
503 self.group_amount = 0.0
504
505 for recibo in lines:
506- txt_remesa += self._individual_obligatorio_19(recibo)
507+ txt_remesa += self._individual_obligatorio_19(cr,uid,recibo)
508 self.total_payments += 1
509 self.group_payments += 1
510 self.group_amount += abs( recibo['amount'] )
511 if order.mode.csb19_extra_concepts:
512- extra_concepts = self._extra_opcional_19(recibo)
513+ extra_concepts = self._extra_opcional_19(cr,uid,recibo)
514 txt_remesa += extra_concepts['texto']
515 self.total_optional_lines += extra_concepts['total_lines']
516 self.group_optional_lines += extra_concepts['total_lines']
517 if recibo['communication2']:
518- txt_remesa += self._individual_opcional_19(recibo)
519+ txt_remesa += self._individual_opcional_19(cr,uid,recibo)
520 self.total_optional_lines += 1
521 self.group_optional_lines += 1
522
523- txt_remesa += self._total_ordenante_19()
524+ txt_remesa += self._total_ordenante_19(cr,uid)
525
526- txt_remesa += self._total_general_19()
527+ txt_remesa += self._total_general_19(cr,uid)
528 return txt_remesa
529-
530-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
531+csb_19()
532\ No newline at end of file
533
534=== modified file 'l10n_es_payment_order/wizard/csb_32.py'
535--- l10n_es_payment_order/wizard/csb_32.py 2011-08-29 15:11:11 +0000
536+++ l10n_es_payment_order/wizard/csb_32.py 2013-01-07 16:37:28 +0000
537@@ -18,6 +18,9 @@
538 # Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 2009
539 # Jordi Esteve <jesteve@zikzakmedia.com>
540 #
541+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
542+# Ignacio Ibeas <ignacio@acysos.com>
543+#
544 # This program is free software: you can redistribute it and/or modify
545 # it under the terms of the GNU Affero General Public License as published by
546 # the Free Software Foundation, either version 3 of the License, or
547@@ -33,20 +36,22 @@
548 #
549 ##############################################################################
550
551+from osv import osv, fields
552 from datetime import datetime
553 from tools.translate import _
554-from converter import *
555-
556-
557-class csb_32:
558-
559- def _cabecera_fichero_32(self):
560+from log import *
561+
562+class csb_32(osv.osv):
563+ _name = 'csb.32'
564+ _auto = False
565+ def _cabecera_fichero_32(self, cr, uid):
566+ converter = self.pool.get('payment.converter.spain')
567 texto = '0265'
568 texto += ' '
569 texto += datetime.today().strftime('%d%m%y')
570- texto += digits_only( self.order.reference )[-4:]
571+ texto += converter.digits_only(cr, uid, self.order.reference )[-4:]
572 texto += ' '*35
573- texto += digits_only( self.order.mode.bank_id.acc_number )[:8]
574+ texto += converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number )[:8]
575 texto += ' '*6
576 texto += ' '*61
577 texto += ' '*24
578@@ -55,7 +60,8 @@
579 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Cabecera fichero 32', texto), True)
580 return texto
581
582- def _cabecera_remesa_32(self, cr, context):
583+ def _cabecera_remesa_32(self, cr, uid, context):
584+ converter = self.pool.get('payment.converter.spain')
585 # A:
586 texto = '1165'
587 texto += ' '
588@@ -66,42 +72,43 @@
589 texto += ' '*12
590
591 # C
592- texto += convert(cr, self.order.mode.cedente, 15, context) # TODO: Identificador del cedente. Qué es?
593+ texto += converter.convert(cr, uid, self.order.mode.cedente, 15, context) # TODO: Identificador del cedente. Qué es?
594 texto += '1' # Identificativo de efectos truncados
595 texto += ' '*21
596
597 # D
598- texto += digits_only( self.order.mode.bank_id.acc_number )
599- texto += digits_only( self.order.mode.bank_id.acc_number )
600- texto += digits_only( self.order.mode.bank_id.acc_number )
601+ texto += converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number )
602+ texto += converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number )
603+ texto += converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number )
604 texto += ' ' + ' '*24
605 texto += '\r\n'
606 if len(texto) != 152:
607 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Cabecera remesa 32', texto), True)
608 return texto
609
610- def _registro_individual_i_32(self, cr, recibo, context):
611+ def _registro_individual_i_32(self, cr, uid, recibo, context):
612+ converter = self.pool.get('payment.converter.spain')
613 # A
614 texto = '2565'
615 texto += ' '
616 # B
617- texto += convert(cr, self.num_recibos+1, 15, context)
618+ texto += converter.convert(cr, uid, self.num_recibos+1, 15, context)
619 texto += datetime.today().strftime('%d%m%y')
620 texto += '0001'
621
622 # C
623 state = self.order.mode.bank_id.state_id and self.order.mode.bank_id.state_id.code or False
624- texto += convert(cr, state, 2, context)
625+ texto += converter.convert(cr, uid, state, 2, context)
626 texto += ' '*7
627 texto += ' '
628
629 # D
630- texto += convert(cr, self.order.mode.bank_id.city, 20, context)
631+ texto += converter.convert(cr, uid, self.order.mode.bank_id.city, 20, context)
632 texto += ' '
633
634 # E
635 texto += ' '*24
636- texto += convert(cr, abs(recibo['amount']), 9, context)
637+ texto += converter.convert(cr, uid, abs(recibo['amount']), 9, context)
638 texto += ' '*15
639 texto += datetime.strptime( recibo['ml_maturity_date'], '%Y-%m-%d').strftime('%d%m%y')
640 texto += ' '*(6+6+1+4+16)
641@@ -110,13 +117,14 @@
642 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Registro individual I 32', texto), True)
643 return texto
644
645- def _registro_individual_ii_32(self, cr, recibo, context):
646+ def _registro_individual_ii_32(self, cr, uid, recibo, context):
647+ converter = self.pool.get('payment.converter.spain')
648 # A: Identificacion de la operacion
649 texto = '2665'
650 texto += ' '
651
652 # B: Datos del efecto
653- texto += convert(cr, self.num_recibos+1, 15, context)
654+ texto += converter.convert(cr, uid, self.num_recibos+1, 15, context)
655 texto += ' '
656 texto += '2' # Recibo
657 texto += '000000'
658@@ -132,42 +140,44 @@
659 texto += ' '*20
660
661 # D: Datos del efecto
662- texto += convert(cr, self.order.mode.partner_id.name, 34, context)
663- texto += convert(cr, recibo['partner_id'].name, 34, context)
664+ texto += converter.convert(cr, uid, self.order.mode.partner_id.name, 34, context)
665+ texto += converter.convert(cr, uid, recibo['partner_id'].name, 34, context)
666 texto += ' '*30
667 texto += '\r\n'
668 if len(texto) != 152:
669 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Registro individual II 32', texto), True)
670 return texto
671
672- def _registro_individual_iii_32(self, cr, recibo, context):
673+ def _registro_individual_iii_32(self, cr, uid, recibo, context):
674+ converter = self.pool.get('payment.converter.spain')
675 # A: Identificacion de la operacion
676 texto = '2765'
677 texto += ' '
678
679 # B: Datos del efecto
680- texto += convert(cr, self.num_recibos+1, 15, context)
681+ texto += converter.convert(cr, uid, self.num_recibos+1, 15, context)
682 texto += ' '
683- addresses = self.pool.get('res.partner').address_get(self.cr, self.uid, [recibo['partner_id'].id] )
684+ addresses = self.pool.get('res.partner').address_get(cr, uid, [recibo['partner_id'].id] )
685 #if not addresses:
686 # print "NO ADDRESSES"
687- address = self.pool.get('res.partner.address').browse(self.cr, self.uid, addresses['default'], self.context)
688- texto += convert( cr, address.street, 34, context )
689- texto += convert( cr, address.zip, 5, context )
690- texto += convert( cr, address.city, 20, context )
691- texto += convert( cr, address.state_id and address.state_id.code or False, 2, context )
692+ address = self.pool.get('res.partner.address').browse(cr, uid, addresses['default'], context)
693+ texto += converter.convert( cr, uid, address.street, 34, context )
694+ texto += converter.convert( cr, uid, address.zip, 5, context )
695+ texto += converter.convert( cr, uid, address.city, 20, context )
696+ texto += converter.convert( cr, uid, address.state_id and address.state_id.code or False, 2, context )
697 texto += '0'*7
698
699 # C: Datos del efecto
700 vat = recibo['partner_id'].vat and recibo['partner_id'].vat[2:] or False
701- texto += convert(cr, vat, 9, context)
702+ texto += converter.convert(cr, uid, vat, 9, context)
703 texto += ' '*50
704 texto += '\r\n'
705 if len(texto) != 152:
706 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Registro individual III 32', texto), True)
707 return texto
708
709- def _registro_fin_remesa_32(self, cr, context):
710+ def _registro_fin_remesa_32(self, cr, uid, context):
711+ converter = self.pool.get('payment.converter.spain')
712 # A: Identificación de la operación
713 texto = '7165'
714 texto += ' '
715@@ -182,20 +192,21 @@
716
717 # D: Acumuladores de importe
718 texto += ' '*10
719- texto += convert( cr, abs(self.order.total), 10, context )
720+ texto += converter.convert( cr, uid, abs(self.order.total), 10, context )
721 texto += ' '*(10+6+7+6+6+6)
722
723 # E: Controles de lectura de fichero
724 texto += ' '*5
725- texto += convert(cr, (self.num_recibos*3) + 2, 7, context)
726- texto += convert(cr, self.num_recibos, 6, context)
727+ texto += converter.convert(cr, uid, (self.num_recibos*3) + 2, 7, context)
728+ texto += converter.convert(cr, uid, self.num_recibos, 6, context)
729 texto += ' '*6
730 texto += '\r\n'
731 if len(texto) != 152:
732 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Fin remesa 32', texto), True)
733 return texto
734
735- def _registro_fin_fichero_32(self, cr, context):
736+ def _registro_fin_fichero_32(self, cr, uid, context):
737+ converter = self.pool.get('payment.converter.spain')
738 # A: Identificación de la operación
739 texto = '9865'
740 texto += ' '
741@@ -208,40 +219,35 @@
742
743 # D: Acumuladores de importes
744 texto += ' '*10
745- texto += convert( cr, abs(self.order.total), 10, context )
746+ texto += converter.convert( cr, uid, abs(self.order.total), 10, context )
747 texto += ' '*(10+6+7+6+6+6)
748
749 # E: Controles de lectura del fichero
750 texto += '00001'
751- texto += convert(cr, (self.num_recibos*3) + 3, 7, context)
752- texto += convert(cr, self.num_recibos, 6, context)
753+ texto += converter.convert(cr, uid, (self.num_recibos*3) + 3, 7, context)
754+ texto += converter.convert(cr, uid, self.num_recibos, 6, context)
755 texto += ' '*6
756 texto += '\r\n'
757 if len(texto) != 152:
758 raise Log(_('Configuration error:\n\nThe line "%s" is not 150 characters long:\n%s') % ('Fin fichero 32', texto), True)
759 return texto
760
761- def create_file(self, pool, cr, uid, order, lines, context):
762- self.pool = pool
763- self.cr = cr
764- self.uid = uid
765+ def create_file(self, cr, uid, order, lines, context):
766 self.order = order
767- self.context = context
768
769 txt_remesa = ''
770 self.num_recibos = 0
771 self.num_lineas_opc = 0
772
773- txt_remesa += self._cabecera_fichero_32()
774- txt_remesa += self._cabecera_remesa_32(cr, context)
775+ txt_remesa += self._cabecera_fichero_32(cr,uid)
776+ txt_remesa += self._cabecera_remesa_32(cr, uid, context)
777 for recibo in lines:
778- txt_remesa += self._registro_individual_i_32(cr, recibo, context)
779- txt_remesa += self._registro_individual_ii_32(cr, recibo, context)
780- txt_remesa += self._registro_individual_iii_32(cr, recibo, context)
781+ txt_remesa += self._registro_individual_i_32(cr, uid, recibo, context)
782+ txt_remesa += self._registro_individual_ii_32(cr, uid, recibo, context)
783+ txt_remesa += self._registro_individual_iii_32(cr, uid, recibo, context)
784 self.num_recibos = self.num_recibos + 1
785- txt_remesa += self._registro_fin_remesa_32(cr, context)
786- txt_remesa += self._registro_fin_fichero_32(cr, context)
787+ txt_remesa += self._registro_fin_remesa_32(cr, uid, context)
788+ txt_remesa += self._registro_fin_fichero_32(cr, uid, context)
789 return txt_remesa
790
791-
792-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
793+csb_32()
794
795=== modified file 'l10n_es_payment_order/wizard/csb_34.py'
796--- l10n_es_payment_order/wizard/csb_34.py 2011-09-20 06:47:43 +0000
797+++ l10n_es_payment_order/wizard/csb_34.py 2013-01-07 16:37:28 +0000
798@@ -20,6 +20,9 @@
799 # Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 2009
800 # Jordi Esteve <jesteve@zikzakmedia.com>
801 #
802+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
803+# Ignacio Ibeas <ignacio@acysos.com>
804+#
805 # This program is free software: you can redistribute it and/or modify
806 # it under the terms of the GNU Affero General Public License as published by
807 # the Free Software Foundation, either version 3 of the License, or
808@@ -35,21 +38,17 @@
809 #
810 ##############################################################################
811
812+from osv import osv, fields
813 from datetime import datetime
814 from tools.translate import _
815-from converter import *
816+from log import *
817 import time
818
819-csb34_code = {
820- 'transfer': '56',
821- 'cheques': '57',
822- 'promissory_note': '58',
823- 'certified_payments': '59',
824-}
825-
826-class csb_34:
827-
828- def get_message(self, recibo, message=None):
829+class csb_34(osv.osv):
830+ _name = 'csb.34'
831+ _auto = False
832+
833+ def get_message(self, cr, uid, recibo, message=None):
834 """
835 Evaluates an expression and returns its value
836 @param recibo: Order line data
837@@ -78,17 +77,19 @@
838 message = message.replace('${' + field + '}', value)
839 return message
840
841- def _start_34(self, cr, context):
842- return convert(cr, self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo, 12, context)
843+ def _start_34(self, cr, uid, context):
844+ converter = self.pool.get('payment.converter.spain')
845+ return converter.convert(cr, uid, self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo, 12, context)
846
847 def _cabecera_ordenante_34(self, cr, uid, context):
848+ converter = self.pool.get('payment.converter.spain')
849 today = datetime.today().strftime('%d%m%y')
850
851 text = ''
852
853 # Primer tipo
854 text += '0362'
855- text += self._start_34(cr, context)
856+ text += self._start_34(cr, uid, context)
857 text += 12*' '
858 text += '001'
859 text += today
860@@ -97,24 +98,23 @@
861 text += planned.strftime('%d%m%y')
862 else:
863 text += today
864- #text += self.convert(self.order.mode.nombre, 40)
865- text += convert_bank_account(cr, self.order.mode.bank_id.acc_number, self.order.mode.partner_id.name, context)
866+ text += converter.convert_bank_account(cr, uid, self.order.mode.bank_id.acc_number, self.order.mode.partner_id.name, context)
867 text += '0'
868 text += 8*' '
869 text += '\r\n'
870
871 # Segundo Tipo
872 text += '0362'
873- text += self._start_34(cr, context)
874+ text += self._start_34(cr, uid, context)
875 text += 12*' '
876 text += '002'
877- text += convert(cr, self.order.mode.bank_id.partner_id.name, 36, context)
878+ text += converter.convert(cr, uid, self.order.mode.bank_id.partner_id.name, 36, context)
879 text += 5*' '
880 text += '\r\n'
881
882 # Tercer Tipo
883 text += '0362'
884- text += self._start_34(cr, context)
885+ text += self._start_34(cr, uid, context)
886 text += 12*' '
887 text += '003'
888 # Direccion
889@@ -126,17 +126,17 @@
890 address = self.pool.get('res.partner.address').read(cr, uid, [address_ids.get('default')], ['street','zip','city'], context)[0]
891 else:
892 raise Log( _('User error:\n\nCompany %s has no invoicing or default address.') % self.order.mode.bank_id.partner_id.name )
893- text += convert(cr, address['street'], 36, context)
894+ text += converter.convert(cr, uid, address['street'], 36, context)
895 text += 5*' '
896 text += '\r\n'
897
898 # Cuarto Tipo
899 text += '0362'
900- text += self._start_34(cr, context)
901+ text += self._start_34(cr, uid, context)
902 text += 12*' '
903 text += '004'
904- text += convert(cr, address['zip'], 6, context)
905- text += convert(cr, address['city'], 30, context)
906+ text += converter.convert(cr, uid, address['zip'], 6, context)
907+ text += converter.convert(cr, uid, address['city'], 30, context)
908 text += 5*' '
909 text += '\r\n'
910 if len(text)%74 != 0:
911@@ -145,7 +145,7 @@
912
913 def _cabecera_nacionales_34(self, cr, uid, context):
914 text = '0456'
915- text += self._start_34(cr, context)
916+ text += self._start_34(cr, uid, context)
917 text += 12*' '
918 text += 3*' '
919 text += 41*' '
920@@ -155,7 +155,13 @@
921 return text
922
923 def _detalle_nacionales_34(self, cr, uid, recibo, csb34_type, context):
924-
925+ converter = self.pool.get('payment.converter.spain')
926+ csb34_code = {
927+ 'transfer': '56',
928+ 'cheques': '57',
929+ 'promissory_note': '58',
930+ 'certified_payments': '59',
931+ }
932 address = None
933 address_ids = self.pool.get('res.partner').address_get(cr, uid, [recibo['partner_id'].id], ['invoice', 'default'])
934 if address_ids.get('invoice'):
935@@ -169,17 +175,16 @@
936 text = ''
937 text += '06'
938 text += csb34_code[csb34_type]
939- text += self._start_34(cr, context)
940- text += convert(cr, recibo['partner_id'].vat, 12, context)
941+ text += self._start_34(cr, uid, context)
942+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
943 text += '010'
944- text += convert(cr, abs(recibo['amount']), 12, context)
945- #text += convert_bank_account(cr, recibo['bank_id'].acc_number, recibo['partner_id'].name, context)
946+ text += converter.convert(cr, uid, abs(recibo['amount']), 12, context)
947
948 # Si la orden se emite para transferencia
949 csb34_type = self.order.mode.csb34_type
950 if csb34_type == 'transfer':
951 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
952- ccc = digits_only(ccc)
953+ ccc = converter.digits_only(cr, uid, ccc)
954 text += ccc[:20].zfill(20)
955 # Si la orden se emite para pagaré, cheque o pago certificado
956 else:
957@@ -220,10 +225,10 @@
958 # Segundo Registro
959 text += '06'
960 text += csb34_code[csb34_type]
961- text += self._start_34(cr, context)
962- text += convert(cr, recibo['partner_id'].vat, 12, context)
963+ text += self._start_34(cr, uid, context)
964+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
965 text += '011'
966- text += convert(cr, recibo['partner_id'].name, 36, context)
967+ text += converter.convert(cr, uid, recibo['partner_id'].name, 36, context)
968 text += 5*' '
969 text += '\r\n'
970
971@@ -236,10 +241,10 @@
972 for (code, street) in lines:
973 text += '06'
974 text += csb34_code[csb34_type]
975- text += self._start_34(cr, context)
976- text += convert(cr, recibo['partner_id'].vat, 12, context)
977+ text += self._start_34(cr, uid, context)
978+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
979 text += code
980- text += convert(cr, street, 36, context)
981+ text += converter.convert(cr, uid, street, 36, context)
982 text += 5*' '
983 text += '\r\n'
984
985@@ -247,11 +252,11 @@
986 if address.zip or address.city:
987 text += '06'
988 text += csb34_code[csb34_type]
989- text += self._start_34(cr, context)
990- text += convert(cr, recibo['partner_id'].vat, 12, context)
991+ text += self._start_34(cr, uid, context)
992+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
993 text += '014'
994- text += convert(cr, address.zip, 6, context)
995- text += convert(cr, address.city, 30, context)
996+ text += converter.convert(cr, uid, address.zip, 6, context)
997+ text += converter.convert(cr, uid, address.city, 30, context)
998 text += 5*' '
999 text += '\r\n'
1000
1001@@ -262,13 +267,13 @@
1002 # Sexto Registro
1003 text += '06'
1004 text += csb34_code[csb34_type]
1005- text += self._start_34(cr, context)
1006- text += convert(cr, recibo['partner_id'].vat, 12, context)
1007+ text += self._start_34(cr, uid, context)
1008+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1009 text += '015'
1010 country_code = address.country_id and address.country_id.code or ''
1011 state = address.state_id and address.state_id.name or ''
1012- text += convert(cr, country_code, 2, context)
1013- text += convert(cr, state, 34, context)
1014+ text += converter.convert(cr, uid, country_code, 2, context)
1015+ text += converter.convert(cr, uid, state, 34, context)
1016 text += 5*' '
1017 text += '\r\n'
1018
1019@@ -278,43 +283,43 @@
1020 if self.order.mode.payroll_check:
1021 text += '06'
1022 text += csb34_code[csb34_type]
1023- text += self._start_34(cr, context)
1024- text += convert(cr, recibo['partner_id'].vat, 12, context)
1025+ text += self._start_34(cr, uid, context)
1026+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1027 text += '018'
1028- text += convert(cr, recibo['partner_id'].vat, 36, context)
1029+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 36, context)
1030 text += 5*' '
1031 text += '\r\n'
1032
1033 # Registro ciento uno (registro usados por algunos bancos como texto de la carta)
1034 text += '06'
1035 text += csb34_code[csb34_type]
1036- text += self._start_34(cr, context)
1037- text += convert(cr, recibo['partner_id'].vat, 12, context)
1038+ text += self._start_34(cr, uid, context)
1039+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1040 text += '101'
1041- message = self.get_message(recibo, self.order.mode.text1)
1042- text += convert(cr, message, 36, context)
1043+ message = self.get_message(cr, uid, recibo, self.order.mode.text1)
1044+ text += converter.convert(cr, uid, message, 36, context)
1045 text += 5*' '
1046 text += '\r\n'
1047
1048 # Registro ciento dos (registro usados por algunos bancos como texto de la carta)
1049 text += '06'
1050 text += csb34_code[csb34_type]
1051- text += self._start_34(cr, context)
1052- text += convert(cr, recibo['partner_id'].vat, 12, context)
1053+ text += self._start_34(cr, uid, context)
1054+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1055 text += '102'
1056- message = self.get_message(recibo, self.order.mode.text2)
1057- text += convert(cr, message, 36, context)
1058+ message = self.get_message(cr, uid, recibo, self.order.mode.text2)
1059+ text += converter.convert(cr, uid, message, 36, context)
1060 text += 5*' '
1061 text += '\r\n'
1062
1063 # Registro ciento tres (registro usados por algunos bancos como texto de la carta)
1064 text += '06'
1065 text += csb34_code[csb34_type]
1066- text += self._start_34(cr, context)
1067- text += convert(cr, recibo['partner_id'].vat, 12, context)
1068+ text += self._start_34(cr, uid, context)
1069+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1070 text += '103'
1071- message = self.get_message(recibo, self.order.mode.text3)
1072- text += convert(cr, message, 36, context)
1073+ message = self.get_message(cr, uid, recibo, self.order.mode.text3)
1074+ text += converter.convert(cr, uid, message, 36, context)
1075 text += 5*' '
1076 text += '\r\n'
1077
1078@@ -330,10 +335,10 @@
1079 message = day+month+year
1080 text += '06'
1081 text += csb34_code[csb34_type]
1082- text += self._start_34(cr, context)
1083- text += convert(cr, recibo['partner_id'].vat, 12, context)
1084+ text += self._start_34(cr, uid, context)
1085+ text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
1086 text += '910'
1087- text += convert(cr, message, 36, context)
1088+ text += converter.convert(cr, uid, message, 36, context)
1089 text += 5*' '
1090 text += '\r\n'
1091
1092@@ -342,13 +347,14 @@
1093 return text
1094
1095 def _totales_nacionales_34(self, cr, uid, values, context):
1096+ converter = self.pool.get('payment.converter.spain')
1097 text = '0856'
1098- text += self._start_34(cr, context)
1099+ text += self._start_34(cr, uid, context)
1100 text += 12*' '
1101 text += 3*' '
1102- text += convert(cr, self.order.total, 12, context)
1103- text += convert(cr, values[0], 8, context)
1104- text += convert(cr, values[1], 10, context)
1105+ text += converter.convert(cr, uid, self.order.total, 12, context)
1106+ text += converter.convert(cr, uid, values[0], 8, context)
1107+ text += converter.convert(cr, uid, values[1], 10, context)
1108 text += 6*' '
1109 text += 5*' '
1110 text += '\r\n'
1111@@ -357,13 +363,14 @@
1112 return text
1113
1114 def _total_general_34(self, cr, uid, values, context):
1115+ converter = self.pool.get('payment.converter.spain')
1116 text = '0962'
1117- text += self._start_34(cr, context)
1118+ text += self._start_34(cr, uid, context)
1119 text += 12*' '
1120 text += 3*' '
1121- text += convert(cr, self.order.total, 12, context)
1122- text += convert(cr, values[0], 8, context)
1123- text += convert(cr, values[1], 10, context)
1124+ text += converter.convert(cr, uid, self.order.total, 12, context)
1125+ text += converter.convert(cr, uid, values[0], 8, context)
1126+ text += converter.convert(cr, uid, values[1], 10, context)
1127 text += 6*' '
1128 text += 5*' '
1129 text += '\r\n'
1130@@ -371,10 +378,8 @@
1131 raise Log(_('Configuration error:\n\nThe line "%s" is not 72 characters long:\n%s') % ('Total general 34', text), True)
1132 return text
1133
1134- def create_file(self, pool, cr, uid, order, lines, context):
1135- self.pool = pool
1136+ def create_file(self, cr, uid, order, lines, context):
1137 self.order = order
1138- self.context = context
1139
1140 payment_line_count = 0
1141 record_count = 0
1142@@ -394,4 +399,4 @@
1143 file += self._total_general_34(cr, uid, values, context)
1144 return file
1145
1146-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1147+csb_34()
1148
1149=== modified file 'l10n_es_payment_order/wizard/csb_34_01.py'
1150--- l10n_es_payment_order/wizard/csb_34_01.py 2012-05-28 19:13:52 +0000
1151+++ l10n_es_payment_order/wizard/csb_34_01.py 2013-01-07 16:37:28 +0000
1152@@ -23,6 +23,9 @@
1153 # Adaptacion de la norma 34-01 para emision de pagos. Validado para La Caixa: 2012
1154 # Joan M. Grande <totaler@gmail.com>
1155 #
1156+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
1157+# Ignacio Ibeas <ignacio@acysos.com>
1158+#
1159 # This program is free software: you can redistribute it and/or modify
1160 # it under the terms of the GNU Affero General Public License as published by
1161 # the Free Software Foundation, either version 3 of the License, or
1162@@ -38,22 +41,28 @@
1163 #
1164 ##############################################################################
1165
1166+from osv import osv, fields
1167 from datetime import datetime
1168 from tools.translate import _
1169-from converter import *
1170+from log import *
1171
1172-class csb_34_01:
1173- def _start_34(self, cr, context):
1174- return convert(cr, self.order.mode.bank_id.partner_id.vat[2:], 10, context, 'right')
1175+class csb_34_01(osv.osv):
1176+ _name = 'csb.3401'
1177+ _auto = False
1178+
1179+ def _start_34(self, cr, uid, context):
1180+ converter = self.pool.get('payment.converter.spain')
1181+ return converter.convert(cr, uid, self.order.mode.bank_id.partner_id.vat[2:], 10, context, 'right')
1182
1183 def _cabecera_ordenante_34(self, cr, uid, context):
1184+ converter = self.pool.get('payment.converter.spain')
1185 today = datetime.today().strftime('%d%m%y')
1186
1187 text = ''
1188
1189 # Primer tipo
1190 text += '0356'
1191- text += self._start_34(cr, context)
1192+ text += self._start_34(cr, uid, context)
1193 text += '34016'
1194 text += 7*' '
1195 text += '001'
1196@@ -64,7 +73,7 @@
1197 else:
1198 text += today
1199 #text += self.convert(self.order.mode.nombre, 40)
1200- ccc = bank_account_parts(cr, self.order.mode.bank_id.acc_number, self.order.mode.partner_id.name, context)
1201+ ccc = converter.bank_account_parts(cr, uid, self.order.mode.bank_id.acc_number, self.order.mode.partner_id.name, context)
1202 text += ccc['bank']
1203 text += ccc['office']
1204 text += ccc['account']
1205@@ -77,17 +86,17 @@
1206
1207 # Segundo Tipo
1208 text += '0356'
1209- text += self._start_34(cr, context)
1210+ text += self._start_34(cr, uid, context)
1211 text += '34016'
1212 text += 7*' '
1213 text += '002'
1214- text += convert(cr, self.order.mode.bank_id.partner_id.name, 36, context)
1215+ text += converter.convert(cr, uid, self.order.mode.bank_id.partner_id.name, 36, context)
1216 text += 7*' '
1217 text += '\n'
1218
1219 # Tercer Tipo
1220 text += '0356'
1221- text += self._start_34(cr, context)
1222+ text += self._start_34(cr, uid, context)
1223 text += '34016'
1224 text += 7*' '
1225 text += '003'
1226@@ -97,35 +106,34 @@
1227 raise Log( _('User error:\n\nCompany %s has no invoicing address.') % address_id )
1228
1229 street = self.pool.get('res.partner.address').read(cr, uid, [address_id], ['street'], context)[0]['street']
1230- text += convert(cr, street, 36, context)
1231+ text += converter.convert(cr, uid, street, 36, context)
1232 text += 7*' '
1233 text += '\n'
1234
1235 # Cuarto Tipo
1236 text += '0356'
1237- text += self._start_34(cr, context)
1238+ text += self._start_34(cr, uid, context)
1239 text += '34016'
1240 text += 7*' '
1241 text += '004'
1242 city = self.pool.get('res.partner.address').read(cr, uid, [address_id], ['city'], context)[0]['city']
1243- text += convert(cr, city, 36, context)
1244+ text += converter.convert(cr, uid, city, 36, context)
1245 text += 7*' '
1246 text += '\n'
1247 return text
1248
1249 def _detalle_nacionales_34(self, cr, uid, recibo, context):
1250+ converter = self.pool.get('payment.converter.spain')
1251 # Primer Registro
1252 text = ''
1253 text += '0656'
1254- text += self._start_34(cr, context)
1255+ text += self._start_34(cr, uid, context)
1256 if not recibo['partner_id'].vat:
1257 raise Log( _('User error:\n\nCompany %s has no vat.') % recibo['partner_id'].name )
1258- text += convert(cr, recibo['partner_id'].vat[2:], 12, context, 'right')
1259+ text += converter.convert(cr, uid, recibo['partner_id'].vat[2:], 12, context, 'right')
1260 text += '010'
1261- text += convert(cr, recibo['amount'], 12, context)
1262- #text += convert_bank_account(cr, recibo['bank_id'].acc_number, recibo['partner_id'].name, context)
1263- #ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
1264- ccc = bank_account_parts(cr, recibo['bank_id'].acc_number, recibo['partner_id'].name, context)
1265+ text += converter.convert(cr, uid, recibo['amount'], 12, context)
1266+ ccc = converter.bank_account_parts(cr, uid, recibo['bank_id'].acc_number, recibo['partner_id'].name, context)
1267 text += ccc['bank']
1268 text += ccc['office']
1269 text += ccc['account']
1270@@ -138,33 +146,32 @@
1271
1272 # Segundo Registro
1273 text += '0656'
1274- text += self._start_34(cr, context)
1275+ text += self._start_34(cr, uid, context)
1276 if not recibo['partner_id'].vat:
1277 raise Log( _('User error:\n\nCompany %s has no vat.') % recibo['partner_id'].name )
1278- text += convert(cr, recibo['partner_id'].vat[2:], 12, context, 'right')
1279+ text += converter.convert(cr, uid, recibo['partner_id'].vat[2:], 12, context, 'right')
1280 text += '011'
1281- text += convert(cr, recibo['partner_id'].name, 36, context)
1282+ text += converter.convert(cr, uid, recibo['partner_id'].name, 36, context)
1283 text += 7*' '
1284 text += '\n'
1285 return text
1286
1287 def _totales_nacionales_34(self, cr, uid, context):
1288+ converter = self.pool.get('payment.converter.spain')
1289 text = '0856'
1290- text += self._start_34(cr, context)
1291+ text += self._start_34(cr, uid, context)
1292 text += 12*' '
1293 text += 3*' '
1294- text += convert(cr, self.order.total, 12, context)
1295- text += convert(cr, self.payment_line_count, 8, context)
1296- text += convert(cr, self.record_count, 10, context)
1297+ text += converter.convert(cr, uid, self.order.total, 12, context)
1298+ text += converter.convert(cr, uid, self.payment_line_count, 8, context)
1299+ text += converter.convert(cr, uid, self.record_count, 10, context)
1300 text += 6*' '
1301 text += 7*' '
1302 text += '\n'
1303 return text
1304
1305- def create_file(self, pool, cr, uid, order, lines, context):
1306- self.pool = pool
1307+ def create_file(self, cr, uid, order, lines, context):
1308 self.order = order
1309- self.context = context
1310
1311 self.payment_line_count = 0
1312 self.record_count = 0
1313@@ -181,4 +188,4 @@
1314
1315 return file
1316
1317-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1318+csb_34_01()
1319
1320=== modified file 'l10n_es_payment_order/wizard/csb_58.py'
1321--- l10n_es_payment_order/wizard/csb_58.py 2011-08-29 15:11:11 +0000
1322+++ l10n_es_payment_order/wizard/csb_58.py 2013-01-07 16:37:28 +0000
1323@@ -18,6 +18,9 @@
1324 # Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 2009
1325 # Jordi Esteve <jesteve@zikzakmedia.com>
1326 #
1327+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
1328+# Ignacio Ibeas <ignacio@acysos.com>
1329+#
1330 # This program is free software: you can redistribute it and/or modify
1331 # it under the terms of the GNU Affero General Public License as published by
1332 # the Free Software Foundation, either version 3 of the License, or
1333@@ -33,19 +36,24 @@
1334 #
1335 ##############################################################################
1336
1337+from osv import osv, fields
1338 from datetime import datetime
1339 from tools.translate import _
1340-from converter import *
1341+from log import *
1342
1343-class csb_58:
1344- def _cabecera_presentador_58(self):
1345+class csb_58(osv.osv):
1346+ _name = 'csb.58'
1347+ _auto = False
1348+
1349+ def _cabecera_presentador_58(self, cr, uid):
1350+ converter = self.pool.get('payment.converter.spain')
1351 texto = '5170'
1352 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1353 texto += datetime.today().strftime('%d%m%y')
1354 texto += 6*' '
1355- texto += to_ascii(self.order.mode.nombre).ljust(40)
1356+ texto += converter.to_ascii(cr, uid, self.order.mode.nombre).ljust(40)
1357 texto += 20*' '
1358- cc = digits_only(self.order.mode.bank_id.acc_number)
1359+ cc = converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number)
1360 texto += cc[0:8]
1361 texto += 66*' '
1362 texto += '\r\n'
1363@@ -53,32 +61,34 @@
1364 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Cabecera presentador 58', texto), True)
1365 return texto
1366
1367- def _cabecera_ordenante_58(self):
1368+ def _cabecera_ordenante_58(self, cr, uid):
1369+ converter = self.pool.get('payment.converter.spain')
1370 texto = '5370'
1371 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1372 texto += datetime.today().strftime('%d%m%y')
1373 texto += 6*' '
1374- texto += to_ascii(self.order.mode.nombre).ljust(40)
1375- cc = digits_only(self.order.mode.bank_id.acc_number)
1376+ texto += converter.to_ascii(cr, uid, self.order.mode.nombre).ljust(40)
1377+ cc = converter.digits_only(cr, uid, self.order.mode.bank_id.acc_number)
1378 texto += cc[0:20]
1379 texto += 8*' '
1380 texto += '06'
1381 texto += 52*' '
1382- texto += self.order.mode.ine and to_ascii(self.order.mode.ine)[:9].zfill(9) or 9*' '
1383+ texto += self.order.mode.ine and converter.to_ascii(cr, uid, self.order.mode.ine)[:9].zfill(9) or 9*' '
1384 texto += 3*' '
1385 texto += '\r\n'
1386 if len(texto) != 164:
1387 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Cabecera ordenante 58', texto), True)
1388 return texto
1389
1390- def _individual_obligatorio_58(self, recibo):
1391+ def _individual_obligatorio_58(self, cr, uid, recibo):
1392+ converter = self.pool.get('payment.converter.spain')
1393 texto = '5670'
1394 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1395 texto += str(recibo['name'])[-12:].zfill(12)
1396- nombre = to_ascii(recibo['partner_id'].name)
1397+ nombre = converter.to_ascii(cr, uid, recibo['partner_id'].name)
1398 texto += nombre[0:40].ljust(40)
1399 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
1400- ccc = digits_only(ccc)
1401+ ccc = converter.digits_only(cr, uid, ccc)
1402 texto += str(ccc)[0:20].zfill(20)
1403 importe = int(round(abs(recibo['amount'])*100,0))
1404 texto += str(importe).zfill(10)
1405@@ -86,7 +96,7 @@
1406 concepto = ''
1407 if recibo['communication']:
1408 concepto = recibo['communication']
1409- texto += to_ascii(concepto)[0:40].ljust(40)
1410+ texto += converter.to_ascii(cr, uid, concepto)[0:40].ljust(40)
1411 if recibo.get('date'):
1412 date_cargo = datetime.strptime(recibo['date'],'%Y-%m-%d')
1413 elif recibo.get('ml_maturity_date'):
1414@@ -100,19 +110,20 @@
1415 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Individual obligatorio 58', texto), True)
1416 return texto
1417
1418- def _individual_opcional_58(self, recibo):
1419+ def _individual_opcional_58(self, cr, uid, recibo):
1420 """Para poner el segundo texto de comunicación"""
1421+ converter = self.pool.get('payment.converter.spain')
1422 texto = '5671'
1423 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1424 texto += str(recibo['name'])[-12:].zfill(12)
1425- texto += to_ascii(recibo['communication2'])[0:134].ljust(134)
1426+ texto += converter.to_ascii(cr, uid, recibo['communication2'])[0:134].ljust(134)
1427 texto += '\r\n'
1428 if len(texto) != 164:
1429 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Individual opcional 58', texto), True)
1430 return texto
1431
1432
1433- def _registro_obligatorio_domicilio_58(self, recibo):
1434+ def _registro_obligatorio_domicilio_58(self, cr, uid, recibo):
1435 """
1436 Registro obligatorio domicilio 58 para no domiciliados.
1437
1438@@ -134,7 +145,7 @@
1439 (DDMMAA)
1440 F2 Libre 155 8 Alfanumérico
1441 """
1442-
1443+ converter = self.pool.get('payment.converter.spain')
1444 alt_format = self.order.mode.alt_domicile_format
1445
1446 #
1447@@ -207,10 +218,10 @@
1448 texto = '5676'
1449 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1450 texto += str(recibo['name'])[-12:].zfill(12)
1451- texto += to_ascii(st)[:40].ljust(40) # Domicilio
1452- texto += to_ascii(city)[:35].ljust(35) # Plaza (ciudad)
1453- texto += to_ascii(zip)[:5].zfill(5) # CP
1454- texto += to_ascii(ord_city)[:38].ljust(38) # Localidad del ordenante (ciudad)
1455+ texto += converter.to_ascii(cr, uid, st)[:40].ljust(40) # Domicilio
1456+ texto += converter.to_ascii(cr, uid, city)[:35].ljust(35) # Plaza (ciudad)
1457+ texto += converter.to_ascii(cr, uid, zip)[:5].zfill(5) # CP
1458+ texto += converter.to_ascii(cr, uid, ord_city)[:38].ljust(38) # Localidad del ordenante (ciudad)
1459 if alt_format:
1460 #
1461 # Si usamos el formato alternativo (basado en FacturaPlus)
1462@@ -223,7 +234,7 @@
1463 texto += date_ct.strftime('%d%m%y') # Fecha crédito
1464 texto += 2*' '
1465 else:
1466- texto += to_ascii(ord_state_code)[:2].zfill(2) # Cod prov del ordenante
1467+ texto += converter.to_ascii(cr, uid, ord_state_code)[:2].zfill(2) # Cod prov del ordenante
1468 texto += date_ct.strftime('%d%m%y') # Fecha crédito
1469 texto += 8*' ' # Libre
1470 texto += '\r\n'
1471@@ -232,7 +243,7 @@
1472 return texto
1473
1474
1475- def _total_ordenante_58(self):
1476+ def _total_ordenante_58(self, cr, uid):
1477 texto = '5870'
1478 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1479 texto += 72*' '
1480@@ -247,7 +258,7 @@
1481 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Total ordenante 58', texto), True)
1482 return texto
1483
1484- def _total_general_58(self):
1485+ def _total_general_58(self, cr, uid):
1486 texto = '5970'
1487 texto += (self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo).zfill(12)
1488 texto += 52*' '
1489@@ -264,39 +275,34 @@
1490 raise Log(_('Configuration error:\n\nThe line "%s" is not 162 characters long:\n%s') % ('Total general 58', texto), True)
1491 return texto
1492
1493- def create_file(self, pool, cr, uid, order, lines, context):
1494- self.pool = pool
1495- self.cr = cr
1496- self.uid = uid
1497+ def create_file(self, cr, uid, order, lines, context):
1498 self.order = order
1499- self.context = context
1500
1501 txt_remesa = ''
1502 self.num_recibos = 0
1503 self.num_lineas_opc = 0
1504
1505- txt_remesa += self._cabecera_presentador_58()
1506- txt_remesa += self._cabecera_ordenante_58()
1507+ txt_remesa += self._cabecera_presentador_58(cr, uid)
1508+ txt_remesa += self._cabecera_ordenante_58(cr, uid)
1509
1510 for recibo in lines:
1511- txt_remesa += self._individual_obligatorio_58(recibo)
1512+ txt_remesa += self._individual_obligatorio_58(cr, uid, recibo)
1513 self.num_recibos = self.num_recibos + 1
1514
1515 # Sólo emitimos el registro individual si communication2 contiene texto
1516 if recibo['communication2'] and len(recibo['communication2'].strip()) > 0:
1517- txt_remesa += self._individual_opcional_58(recibo)
1518+ txt_remesa += self._individual_opcional_58(cr, uid, recibo)
1519 self.num_lineas_opc = self.num_lineas_opc + 1
1520
1521 # Para recibos no domiciliados, añadimos el registro obligatorio
1522 # de domicilio (necesario con algunos bancos/cajas).
1523 if self.order.mode.inc_domicile:
1524- txt_remesa += self._registro_obligatorio_domicilio_58(recibo)
1525+ txt_remesa += self._registro_obligatorio_domicilio_58(cr, uid, recibo)
1526 self.num_lineas_opc = self.num_lineas_opc + 1
1527
1528- txt_remesa += self._total_ordenante_58()
1529- txt_remesa += self._total_general_58()
1530+ txt_remesa += self._total_ordenante_58(cr, uid)
1531+ txt_remesa += self._total_general_58(cr, uid)
1532
1533 return txt_remesa
1534
1535-
1536-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1537+csb_58()
1538
1539=== modified file 'l10n_es_payment_order/wizard/export_remesas.py'
1540--- l10n_es_payment_order/wizard/export_remesas.py 2012-09-08 15:32:47 +0000
1541+++ l10n_es_payment_order/wizard/export_remesas.py 2013-01-07 16:37:28 +0000
1542@@ -24,6 +24,9 @@
1543 # Migración de wizard.interface para la 6.1: Pexego Sistemas Informáticos. 2012
1544 # Marta Vázquez Rodríguez <marta@pexego.es>
1545 #
1546+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
1547+# Ignacio Ibeas <ignacio@acysos.com>
1548+#
1549 # This program is free software: you can redistribute it and/or modify
1550 # it under the terms of the GNU Affero General Public License as published by
1551 # the Free Software Foundation, either version 3 of the License, or
1552@@ -39,16 +42,12 @@
1553 #
1554 ##############################################################################
1555
1556+from osv import osv, fields
1557 import base64
1558 from tools.translate import _
1559-from converter import *
1560-import csb_19
1561-import csb_32
1562-import csb_34
1563-import csb_34_01
1564-import csb_58
1565-
1566-from osv import osv, fields
1567+from log import *
1568+
1569+
1570
1571 class wizard_payment_file_spain(osv.osv_memory):
1572 _name = 'wizard.payment.file.spain'
1573@@ -60,10 +59,10 @@
1574 }
1575
1576 def create_payment_file(self, cr, uid, ids, context):
1577-
1578+ converter = self.pool.get('payment.converter.spain')
1579 txt_remesa = ''
1580 num_lineas_opc = 0
1581-
1582+ form_obj = self.browse(cr, uid, ids)[0]
1583 try:
1584 orden = self.pool.get('payment.order').browse(cr, uid, context['active_id'], context)
1585 if not orden.line_ids:
1586@@ -72,7 +71,7 @@
1587 # Comprobamos que exista número de C.C. y que tenga 20 dígitos
1588 if not orden.mode.bank_id:
1589 raise Log( _('User error:\n\nThe bank account of the company %s is not defined.') % (orden.mode.partner_id.name), True )
1590- cc = digits_only(orden.mode.bank_id.acc_number)
1591+ cc = converter.digits_only(cr,uid,orden.mode.bank_id.acc_number)
1592 if len(cc) != 20:
1593 raise Log( _('User error:\n\nThe bank account number of the company %s has not 20 digits.') % (orden.mode.partner_id.name), True)
1594
1595@@ -81,7 +80,6 @@
1596 raise Log(_('User error:\n\nThe company VAT number related to the bank account of the payment mode is not defined.'), True)
1597
1598 recibos = []
1599- form_obj = self.browse(cr, uid, ids)[0]
1600 if form_obj.join:
1601 # Lista con todos los partners+bancos diferentes de la remesa
1602 partner_bank_l = reduce(lambda l, x: x not in l and l.append(x) or l,
1603@@ -125,23 +123,23 @@
1604 ccc = line['bank_id'] and line['bank_id'].acc_number or False
1605 if not ccc:
1606 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)
1607- ccc = digits_only(ccc)
1608+ ccc = converter.digits_only(cr,uid,ccc)
1609 if len(ccc) != 20:
1610 raise Log(_('User error:\n\nThe bank account number of the customer %s has not 20 digits.') % (line['partner_id'].name), True)
1611
1612 if orden.mode.tipo == 'csb_19':
1613- csb = csb_19.csb_19()
1614+ csb = self.pool.get('csb.19')
1615 elif orden.mode.tipo == 'csb_32':
1616- csb = csb_32.csb_32()
1617+ csb = self.pool.get('csb.32')
1618 elif orden.mode.tipo == 'csb_34':
1619- csb = csb_34.csb_34()
1620+ csb = self.pool.get('csb.34')
1621 elif orden.mode.tipo == '34_01':
1622- csb = csb_34_01.csb_34_01()
1623+ csb = self.pool.get('csb.3401')
1624 elif orden.mode.tipo == 'csb_58':
1625- csb = csb_58.csb_58()
1626+ csb = self.pool.get('csb.58')
1627 else:
1628 raise Log(_('User error:\n\nThe payment mode is not CSB 19, CSB 32, CSB 34 or CSB 58'), True)
1629- txt_remesa = csb.create_file(self.pool, cr, uid, orden, recibos, context)
1630+ txt_remesa = csb.create_file(cr, uid, orden, recibos, context)
1631
1632 except Log, log:
1633 form_obj.write({'note': log,'pay': False})
1634@@ -167,7 +165,6 @@
1635
1636 return True
1637 wizard_payment_file_spain()
1638-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1639
1640
1641
1642
1643=== modified file 'l10n_es_payment_order/wizard/export_remesas_view.xml'
1644--- l10n_es_payment_order/wizard/export_remesas_view.xml 2012-11-15 16:29:52 +0000
1645+++ l10n_es_payment_order/wizard/export_remesas_view.xml 2013-01-07 16:37:28 +0000
1646@@ -29,12 +29,12 @@
1647 <field name="target">new</field>
1648 </record>
1649 <record id="action_wizard_payment_file_spain2" model="ir.values">
1650+ <field name="object" eval="1" />
1651 <field name="name">Create payments file</field>
1652 <field name="key2">client_action_multi</field>
1653 <field name="value" eval="'ir.actions.act_window,' + str(ref('action_wizard_payment_file_spain'))"/>
1654 <field name="key">action</field>
1655 <field name="model">payment.order</field>
1656 </record>
1657-
1658 </data>
1659 </openerp>
1660
1661=== added file 'l10n_es_payment_order/wizard/log.py'
1662--- l10n_es_payment_order/wizard/log.py 1970-01-01 00:00:00 +0000
1663+++ l10n_es_payment_order/wizard/log.py 2013-01-07 16:37:28 +0000
1664@@ -0,0 +1,45 @@
1665+# -*- coding: utf-8 -*-
1666+##############################################################################
1667+#
1668+# OpenERP, Open Source Management Solution
1669+# Copyright (c) 2006 ACYSOS S.L. (http://acysos.com) All Rights Reserved.
1670+# Pedro Tarrafeta <pedro@acysos.com>
1671+# Copyright (c) 2008 Pablo Rocandio. All Rights Reserved.
1672+# Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
1673+# Jordi Esteve <jesteve@zikzakmedia.com>
1674+# Copyright (c) 2009 NaN (http://www.nan-tic.com) All Rights Reserved.
1675+# Albert Cervera i Areny <albert@nan-tic.com>
1676+# $Id$
1677+# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
1678+# Ignacio Ibeas <ignacio@acysos.com>
1679+#
1680+# This program is free software: you can redistribute it and/or modify
1681+# it under the terms of the GNU Affero General Public License as published by
1682+# the Free Software Foundation, either version 3 of the License, or
1683+# (at your option) any later version.
1684+#
1685+# This program is distributed in the hope that it will be useful,
1686+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1687+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1688+# GNU Affero General Public License for more details.
1689+#
1690+# You should have received a copy of the GNU Affero General Public License
1691+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1692+#
1693+##############################################################################
1694+
1695+from tools.translate import _
1696+
1697+class Log(Exception):
1698+ def __init__(self, content = '', error = False):
1699+ self.content = content
1700+ self.error = error
1701+ def add(self, s, error=True):
1702+ self.content = self.content + s
1703+ if error:
1704+ self.error = error
1705+ def __call__(self):
1706+ return self.content
1707+ def __str__(self):
1708+ return self.content
1709+