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