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

Proposed by Ignacio Ibeas (www.acysos.com)
Status: Merged
Merged at revision: 337
Proposed branch: lp:~acysos-team/openerp-spain/openerp-spain-6.1
Merge into: lp:~openerp-spain-team/openerp-spain/6.1
Diff against target: 1709 lines (+441/-353)
13 files modified
l10n_es_payment_order/__openerp__.py (+6/-3)
l10n_es_payment_order/remesas_view.xml (+1/-1)
l10n_es_payment_order/security/ir.model.access.csv (+13/-0)
l10n_es_payment_order/wizard/__init__.py (+8/-0)
l10n_es_payment_order/wizard/converter.py (+83/-90)
l10n_es_payment_order/wizard/csb_19.py (+49/-44)
l10n_es_payment_order/wizard/csb_32.py (+59/-53)
l10n_es_payment_order/wizard/csb_34.py (+79/-74)
l10n_es_payment_order/wizard/csb_34_01.py (+36/-29)
l10n_es_payment_order/wizard/csb_58.py (+44/-38)
l10n_es_payment_order/wizard/export_remesas.py (+17/-20)
l10n_es_payment_order/wizard/export_remesas_view.xml (+1/-1)
l10n_es_payment_order/wizard/log.py (+45/-0)
To merge this branch: bzr merge lp:~acysos-team/openerp-spain/openerp-spain-6.1
Reviewer Review Type Date Requested Status
Ignacio Ibeas (www.acysos.com) Approve
Review via email: mp+142080@code.launchpad.net

Commit message

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

Description of the change

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

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

To post a comment you must log in.
336. By Ignacio Ibeas (www.acysos.com)

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

Revision history for this message
Ignacio Ibeas (www.acysos.com) (ignacio-acysos) wrote :

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

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

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'l10n_es_payment_order/__openerp__.py'
--- l10n_es_payment_order/__openerp__.py 2012-11-15 16:29:52 +0000
+++ l10n_es_payment_order/__openerp__.py 2013-01-07 16:37:28 +0000
@@ -11,6 +11,9 @@
11# Copyright (C) 2011-2012 Ainara Galdona (www.avanzosc.com). All Rights Reserved11# Copyright (C) 2011-2012 Ainara Galdona (www.avanzosc.com). All Rights Reserved
12# $Id$12# $Id$
13#13#
14# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
15# Ignacio Ibeas <ignacio@acysos.com>
16#
14# This program is free software: you can redistribute it and/or modify17# This program is free software: you can redistribute it and/or modify
15# it under the terms of the GNU Affero General Public License as published by18# it under the terms of the GNU Affero General Public License as published by
16# the Free Software Foundation, either version 3 of the License, or19# the Free Software Foundation, either version 3 of the License, or
@@ -28,7 +31,7 @@
2831
29{32{
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",
31 "version" : "1.5",34 "version" : "1.6",
32 "author" : "Acysos SL, Zikzakmedia SL, Pablo Rocandio, NaN·tic",35 "author" : "Acysos SL, Zikzakmedia SL, Pablo Rocandio, NaN·tic",
33 "category" : "Localisation/Accounting",36 "category" : "Localisation/Accounting",
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.
@@ -54,8 +57,8 @@
54 "update_xml" : [57 "update_xml" : [
55 "remesas_report.xml", 58 "remesas_report.xml",
56 "remesas_view.xml", 59 "remesas_view.xml",
57 #"remesas_wizard.xml",60 "wizard/export_remesas_view.xml",
58 "wizard/export_remesas_view.xml"61 "security/ir.model.access.csv"
59 ],62 ],
60 "installable" : True,63 "installable" : True,
61 "active" : False,64 "active" : False,
6265
=== modified file 'l10n_es_payment_order/remesas_view.xml'
--- l10n_es_payment_order/remesas_view.xml 2012-11-15 16:29:52 +0000
+++ l10n_es_payment_order/remesas_view.xml 2013-01-07 16:37:28 +0000
@@ -23,7 +23,7 @@
23 <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>23 <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
24 <field name="arch" type="xml">24 <field name="arch" type="xml">
25 <field name="bank_id" position="replace"/>25 <field name="bank_id" position="replace"/>
26 <field name="partner_id" position="replace"/>26 <field name="partner_id" position="replace"/>
27 <field name="company_id" position="after">27 <field name="company_id" position="after">
28 <field name="tipo"/>28 <field name="tipo"/>
29 <newline/>29 <newline/>
3030
=== added directory 'l10n_es_payment_order/security'
=== added file 'l10n_es_payment_order/security/ir.model.access.csv'
--- l10n_es_payment_order/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
+++ l10n_es_payment_order/security/ir.model.access.csv 2013-01-07 16:37:28 +0000
@@ -0,0 +1,13 @@
1id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2access_csb_19,csb.19,model_csb_19,account_payment.group_account_payment,1,1,1,1
3access_csb_19_user,csb.19.user,model_csb_19,base.group_user,1,0,0,0
4access_csb_32,csb.32,model_csb_32,account_payment.group_account_payment,1,1,1,1
5access_csb_32_user,csb.32.user,model_csb_32,base.group_user,1,0,0,0
6access_csb_34,csb.34,model_csb_34,account_payment.group_account_payment,1,1,1,1
7access_csb_34_user,csb.34.user,model_csb_34,base.group_user,1,0,0,0
8access_csb_3401,csb.3401,model_csb_3401,account_payment.group_account_payment,1,1,1,1
9access_csb_3401_user,csb.3401.user,model_csb_3401,base.group_user,1,0,0,0
10access_csb_58,csb.58,model_csb_58,account_payment.group_account_payment,1,1,1,1
11access_csb_58_user,csb.58.user,model_csb_58,base.group_user,1,0,0,0
12access_payment_converter_spain,payment.converter.spain,model_payment_converter_spain,account_payment.group_account_payment,1,1,1,1
13access_payment_converter_spain_user,payment.converter.spain,model_payment_converter_spain,base.group_user,1,0,0,0
014
=== modified file 'l10n_es_payment_order/wizard/__init__.py'
--- l10n_es_payment_order/wizard/__init__.py 2012-11-15 16:29:52 +0000
+++ l10n_es_payment_order/wizard/__init__.py 2013-01-07 16:37:28 +0000
@@ -10,6 +10,8 @@
10# AvanzOSC, Advanced Open Source Consulting 10# AvanzOSC, Advanced Open Source Consulting
11# Copyright (C) 2011-2012 Ainara Galdona (www.avanzosc.com). All Rights Reserved11# Copyright (C) 2011-2012 Ainara Galdona (www.avanzosc.com). All Rights Reserved
12# $Id$12# $Id$
13# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
14# Ignacio Ibeas <ignacio@acysos.com>
13#15#
14# This program is free software: you can redistribute it and/or modify16# This program is free software: you can redistribute it and/or modify
15# it under the terms of the GNU Affero General Public License as published by17# it under the terms of the GNU Affero General Public License as published by
@@ -27,3 +29,9 @@
27##############################################################################29##############################################################################
2830
29import export_remesas31import export_remesas
32import converter
33import csb_19
34import csb_32
35import csb_34
36import csb_34_01
37import csb_58
3038
=== modified file 'l10n_es_payment_order/wizard/converter.py'
--- l10n_es_payment_order/wizard/converter.py 2012-05-22 15:31:15 +0000
+++ l10n_es_payment_order/wizard/converter.py 2013-01-07 16:37:28 +0000
@@ -10,6 +10,8 @@
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.
11# Albert Cervera i Areny <albert@nan-tic.com>11# Albert Cervera i Areny <albert@nan-tic.com>
12# $Id$12# $Id$
13# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
14# Ignacio Ibeas <ignacio@acysos.com>
13#15#
14# This program is free software: you can redistribute it and/or modify16# This program is free software: you can redistribute it and/or modify
15# it under the terms of the GNU Affero General Public License as published by17# it under the terms of the GNU Affero General Public License as published by
@@ -26,95 +28,86 @@
26#28#
27##############################################################################29##############################################################################
2830
31from osv import osv, fields
29from tools.translate import _32from tools.translate import _
3033from log import *
31def digits_only(cc_in):34
32 """Discards non-numeric chars"""35class payment_converter_spain(osv.osv):
3336 _name= 'payment.converter.spain'
34 cc = ""37 _auto = False
35 for i in cc_in or '':38
36 try:39 def digits_only(self, cr, uid, cc_in):
37 int(i)40 """Discards non-numeric chars"""
38 cc += i41
39 except ValueError:42 cc = ""
40 pass43 for i in cc_in or '':
41 return cc44 try:
4245 int(i)
43def to_ascii(text):46 cc += i
44 """Converts special characters such as those with accents to their ASCII equivalents"""47 except ValueError:
45 old_chars = ['á','é','í','ó','ú','à','è','ì','ò','ù','ä','ë','ï','ö','ü','â','ê','î','ô','û','Á','É','Í','Ú','Ó','À','È','Ì','Ò','Ù','Ä','Ë','Ï','Ö','Ü','Â','Ê','Î','Ô','Û','ñ','Ñ','ç','Ç','ª','º','·','\n']48 pass
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
47 for old, new in zip(old_chars, new_chars):50
48 text = text.replace(unicode(old,'UTF-8'), new)51 def to_ascii(self, cr, uid, text):
49 return text52 """Converts special characters such as those with accents to their ASCII equivalents"""
5053 old_chars = ['á','é','í','ó','ú','à','è','ì','ò','ù','ä','ë','ï','ö','ü','â','ê','î','ô','û','Á','É','Í','Ú','Ó','À','È','Ì','Ò','Ù','Ä','Ë','Ï','Ö','Ü','Â','Ê','Î','Ô','Û','ñ','Ñ','ç','Ç','ª','º','·','\n']
5154 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','.',' ']
52class Log(Exception):55 for old, new in zip(old_chars, new_chars):
53 def __init__(self, content = '', error = False):56 text = text.replace(unicode(old,'UTF-8'), new)
54 self.content = content57 return text
55 self.error = error58
56 def add(self, s, error=True):59 def convert_text(self, cr, uid, text, size, justified='left'):
57 self.content = self.content + s60 if justified == 'left':
58 if error:61 return self.to_ascii(cr,uid,text)[:size].ljust(size)
59 self.error = error62 else:
60 def __call__(self):63 return self.to_ascii(cr,uid,text)[:size].rjust(size)
61 return self.content64
62 def __str__(self):65 def convert_float(self, cr, uid, number, size, context):
63 return self.content66 text = str( int( round( number * 100, 0 ) ) )
6467 if len(text) > size:
65def convert_text(text, size, justified='left'):68 raise Log(_('Error:\n\nCan not convert float number %(number).2f to fit in %(size)d characters.') % {
66 if justified == 'left':69 'number': number,
67 return to_ascii(text)[:size].ljust(size)70 'size': size
68 else: 71 })
69 return to_ascii(text)[:size].rjust(size)72 return text.zfill(size)
7073
71def convert_float(cr, number, size, context):74 def convert_int(self, cr, uid, number, size, context):
72 text = str( int( round( number * 100, 0 ) ) )75 text = str( number )
73 if len(text) > size:76 if len(text) > size:
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.') % {
75 'number': number, 78 'number': number,
76 'size': size79 'size': size
77 })80 })
78 return text.zfill(size)81 return text.zfill(size)
7982
80def convert_int(cr, number, size, context):83 def convert(self, cr, uid, value, size, context, justified='left'):
81 text = str( number )84 if value == False:
82 if len(text) > size:85 return self.convert_text(cr, uid, '', size)
83 raise Log( _('Error:\n\nCan not convert integer number %(number)d to fit in %(size)d characters.') % {86 elif isinstance(value, float):
84 'number': number, 87 return self.convert_float(cr, uid, value, size, context)
85 'size': size88 elif isinstance(value, int):
86 })89 return self.convert_int(cr, uid, value, size, context)
87 return text.zfill(size)90 else:
8891 return self.convert_text(cr, uid, value, size, justified)
89def convert(cr, value, size, context, justified='left'):92
90 if value == False:93 def convert_bank_account(self, cr, uid, value, partner_name, context):
91 return convert_text('', size)94 if not isinstance(value, basestring):
92 elif isinstance(value, float):95 raise Log( _('User error:\n\nThe bank account number of %s is not defined.') % partner_name )
93 return convert_float(cr, value, size, context)96 ccc = self.digits_only(cr, uid, value)
94 elif isinstance(value, int):97 if len(ccc) != 20:
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 )
96 else:99 return ccc
97 return convert_text(value, size, justified)100
98101 def bank_account_parts(self, cr, uid, value, partner_name, context):
99def convert_bank_account(cr, value, partner_name, context):102 if not isinstance(value, basestring):
100 if not isinstance(value, basestring):103 raise Log( _('User error:\n\nThe bank account number of %s is not defined.') % partner_name )
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)
102 ccc = digits_only(value)105 if len(ccc) != 20:
103 if len(ccc) != 20:106 raise Log( _('User error:\n\nThe bank account number of %s does not have 20 digits.') % partner_name )
104 raise Log( _('User error:\n\nThe bank account number of %s does not have 20 digits.') % partner_name )107 return {'bank':ccc[:4],
105 return ccc108 'office': ccc[4:8],
106109 'dc': ccc[8:10],
107def bank_account_parts(cr, value, partner_name, context):110 'account': ccc[10:]}
108 if not isinstance(value, basestring):111
109 raise Log( _('User error:\n\nThe bank account number of %s is not defined.') % partner_name )112payment_converter_spain()
110 ccc = digits_only(value)
111 if len(ccc) != 20:
112 raise Log( _('User error:\n\nThe bank account number of %s does not have 20 digits.') % partner_name )
113 return {'bank':ccc[:4],
114 'office': ccc[4:8],
115 'dc': ccc[8:10],
116 'account': ccc[10:]}
117
118
119# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
120113
121114
=== modified file 'l10n_es_payment_order/wizard/csb_19.py'
--- l10n_es_payment_order/wizard/csb_19.py 2012-09-08 15:32:47 +0000
+++ l10n_es_payment_order/wizard/csb_19.py 2013-01-07 16:37:28 +0000
@@ -21,6 +21,9 @@
21# Añadidos conceptos extras del CSB 19: Acysos S.L. 201121# Añadidos conceptos extras del CSB 19: Acysos S.L. 2011
22# Ignacio Ibeas <ignacio@acysos.com>22# Ignacio Ibeas <ignacio@acysos.com>
23#23#
24# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
25# Ignacio Ibeas <ignacio@acysos.com>
26#
24# This program is free software: you can redistribute it and/or modify27# This program is free software: you can redistribute it and/or modify
25# it under the terms of the GNU Affero General Public License as published by28# it under the terms of the GNU Affero General Public License as published by
26# the Free Software Foundation, either version 3 of the License, or29# the Free Software Foundation, either version 3 of the License, or
@@ -36,20 +39,23 @@
36#39#
37##############################################################################40##############################################################################
3841
42from osv import osv, fields
39from datetime import datetime43from datetime import datetime
40from tools.translate import _44from tools.translate import _
41from converter import *45from log import *
4246
4347class csb_19(osv.osv):
44class csb_19:48 _name = 'csb.19'
45 def _cabecera_presentador_19(self):49 _auto = False
50 def _cabecera_presentador_19(self,cr,uid):
51 converter = self.pool.get('payment.converter.spain')
46 texto = '5180'52 texto = '5180'
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)
48 texto += datetime.today().strftime('%d%m%y')54 texto += datetime.today().strftime('%d%m%y')
49 texto += 6*' '55 texto += 6*' '
50 texto += to_ascii(self.order.mode.nombre).ljust(40)56 texto += converter.to_ascii(cr,uid,self.order.mode.nombre).ljust(40)
51 texto += 20*' '57 texto += 20*' '
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)
53 texto += cc[0:8]59 texto += cc[0:8]
54 texto += 66*' '60 texto += 66*' '
55 texto += '\r\n'61 texto += '\r\n'
@@ -57,7 +63,8 @@
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)
58 return texto64 return texto
5965
60 def _cabecera_ordenante_19(self, recibo=None):66 def _cabecera_ordenante_19(self,cr,uid, recibo=None):
67 converter = self.pool.get('payment.converter.spain')
61 texto = '5380'68 texto = '5380'
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)
63 texto += datetime.today().strftime('%d%m%y')70 texto += datetime.today().strftime('%d%m%y')
@@ -78,8 +85,8 @@
78 date_cargo = datetime.strptime(self.order.date_scheduled,'%Y-%m-%d')85 date_cargo = datetime.strptime(self.order.date_scheduled,'%Y-%m-%d')
7986
80 texto += date_cargo.strftime('%d%m%y')87 texto += date_cargo.strftime('%d%m%y')
81 texto += to_ascii(self.order.mode.nombre).ljust(40)88 texto += converter.to_ascii(cr,uid,self.order.mode.nombre).ljust(40)
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)
83 texto += cc[0:20]90 texto += cc[0:20]
84 texto += 8*' '91 texto += 8*' '
85 texto += '01'92 texto += '01'
@@ -89,14 +96,15 @@
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)
90 return texto97 return texto
9198
92 def _individual_obligatorio_19(self, recibo):99 def _individual_obligatorio_19(self,cr,uid, recibo):
100 converter = self.pool.get('payment.converter.spain')
93 texto = '5680'101 texto = '5680'
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)
95 texto += str(recibo['name'])[-12:].zfill(12)103 texto += str(recibo['name'])[-12:].zfill(12)
96 nombre = to_ascii(recibo['partner_id'].name)104 nombre = converter.to_ascii(cr,uid,recibo['partner_id'].name)
97 texto += nombre[0:40].ljust(40)105 texto += nombre[0:40].ljust(40)
98 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''106 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
99 ccc = digits_only(ccc)107 ccc = converter.digits_only(cr,uid,ccc)
100 texto += str(ccc)[0:20].zfill(20)108 texto += str(ccc)[0:20].zfill(20)
101 importe = int(round(abs(recibo['amount'])*100,0))109 importe = int(round(abs(recibo['amount'])*100,0))
102 texto += str(importe).zfill(10)110 texto += str(importe).zfill(10)
@@ -104,21 +112,19 @@
104 concepto = ''112 concepto = ''
105 if recibo['communication']:113 if recibo['communication']:
106 concepto = recibo['communication']114 concepto = recibo['communication']
107 texto += to_ascii(concepto)[0:48].ljust(48)115 texto += converter.to_ascii(cr,uid,concepto)[0:48].ljust(48)
108 # Esto es lo convencional, descripción de 40 caracteres, pero se puede aprovechar los 8 espacios en blanco finales
109 #texto += to_ascii(concepto)[0:40].ljust(40)
110 #texto += 8*' '
111 texto += '\r\n'116 texto += '\r\n'
112 if len(texto) != 164:117 if len(texto) != 164:
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)
114 return texto119 return texto
115120
116 def _individual_opcional_19(self, recibo):121 def _individual_opcional_19(self,cr,uid, recibo):
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)"""
123 converter = self.pool.get('payment.converter.spain')
118 texto = '5686'124 texto = '5686'
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)
120 texto += str(recibo['name'])[-12:].zfill(12)126 texto += str(recibo['name'])[-12:].zfill(12)
121 texto += to_ascii(recibo['communication2'])[0:115].ljust(115)127 texto += converter.to_ascii(cr,uid,recibo['communication2'])[0:115].ljust(115)
122 texto += '00000' # Campo de código postal ficticio128 texto += '00000' # Campo de código postal ficticio
123 texto += 14*' '129 texto += 14*' '
124 texto += '\r\n'130 texto += '\r\n'
@@ -126,36 +132,37 @@
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)
127 return texto133 return texto
128134
129 def _extra_opcional_19(self, recibo):135 def _extra_opcional_19(self,cr,uid, recibo):
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)"""
137 converter = self.pool.get('payment.converter.spain')
131 res = {}138 res = {}
132 res['texto'] = ''139 res['texto'] = ''
133 res['total_lines'] = 0140 res['total_lines'] = 0
134 counter = 1141 counter = 1
135 registry_counter = 1142 registry_counter = 1
136 lenght = 0143 length = 0
137 for invoice in recibo['ml_inv_ref']:144 for invoice in recibo['ml_inv_ref']:
138 if invoice:145 if invoice:
139 lenght += len(invoice.invoice_line)146 length += len(invoice.invoice_line)
140 for invoice in recibo['ml_inv_ref']:147 for invoice in recibo['ml_inv_ref']:
141 if invoice:148 if invoice:
142 for invoice_line in invoice.invoice_line:149 for invoice_line in invoice.invoice_line:
143 if counter <= lenght:150 if counter <= length:
144 if counter <= 15:151 if counter <= 15:
145 if (counter-1)%3 == 0:152 if (counter-1)%3 == 0:
146 res['texto'] += '568'+str(registry_counter)153 res['texto'] += '568'+str(registry_counter)
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)
148 res['texto'] += str(recibo['name']).zfill(12)155 res['texto'] += str(recibo['name']).zfill(12)
149 price = ' %(#).2f ' % {'#' : invoice_line.price_subtotal}156 price = ' %(#).2f ' % {'#' : invoice_line.price_subtotal}
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))
151 res['texto'] += to_ascii(price.replace('.',','))158 res['texto'] += converter.to_ascii(cr,uid,price.replace('.',','))
152 if counter % 3 == 0:159 if counter % 3 == 0:
153 res['texto'] += 14*' '+'\r\n'160 res['texto'] += 14*' '+'\r\n'
154 res['total_lines'] += 1161 res['total_lines'] += 1
155 if len(res['texto']) != registry_counter*164:162 if len(res['texto']) != registry_counter*164:
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)
157 registry_counter += 1164 registry_counter += 1
158 elif counter == lenght:165 elif counter == length:
159 res['texto'] += (3-(counter % 3))*40*' '+14*' '+'\r\n'166 res['texto'] += (3-(counter % 3))*40*' '+14*' '+'\r\n'
160 res['total_lines'] += 1167 res['total_lines'] += 1
161 if len(res['texto']) != registry_counter*164:168 if len(res['texto']) != registry_counter*164:
@@ -163,7 +170,7 @@
163 counter += 1170 counter += 1
164 return res171 return res
165172
166 def _total_ordenante_19(self):173 def _total_ordenante_19(self,cr,uid):
167 texto = '5880'174 texto = '5880'
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)
169 texto += 72*' '176 texto += 72*' '
@@ -178,7 +185,7 @@
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)
179 return texto186 return texto
180187
181 def _total_general_19(self):188 def _total_general_19(self,cr,uid):
182 texto = '5980'189 texto = '5980'
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)
184 texto += 52*' '191 texto += 52*' '
@@ -206,7 +213,7 @@
206 return texto213 return texto
207214
208215
209 def create_file(self, pool, cr, uid, order, lines, context):216 def create_file(self, cr, uid, order, lines, context):
210 self.order = order217 self.order = order
211218
212 txt_remesa = ''219 txt_remesa = ''
@@ -216,7 +223,7 @@
216 self.group_optional_lines = 0223 self.group_optional_lines = 0
217 self.group_amount = 0.0224 self.group_amount = 0.0
218225
219 txt_remesa += self._cabecera_presentador_19()226 txt_remesa += self._cabecera_presentador_19(cr,uid)
220227
221 if order.date_prefered == 'due':228 if order.date_prefered == 'due':
222 # Tantos ordenantes como pagos229 # Tantos ordenantes como pagos
@@ -225,48 +232,46 @@
225 self.group_optional_lines = 0232 self.group_optional_lines = 0
226 self.group_amount = 0.0233 self.group_amount = 0.0
227234
228 txt_remesa += self._cabecera_ordenante_19(recibo)235 txt_remesa += self._cabecera_ordenante_19(cr,uid,recibo)
229 txt_remesa += self._individual_obligatorio_19(recibo)236 txt_remesa += self._individual_obligatorio_19(cr,uid,recibo)
230 self.total_payments += 1237 self.total_payments += 1
231 self.group_payments += 1238 self.group_payments += 1
232 self.group_amount += abs( recibo['amount'] )239 self.group_amount += abs( recibo['amount'] )
233 if order.mode.csb19_extra_concepts:240 if order.mode.csb19_extra_concepts:
234 extra_concepts = self._extra_opcional_19(recibo)241 extra_concepts = self._extra_opcional_19(cr,uid,recibo)
235 txt_remesa += extra_concepts['texto']242 txt_remesa += extra_concepts['texto']
236 self.total_optional_lines += extra_concepts['total_lines']243 self.total_optional_lines += extra_concepts['total_lines']
237 self.group_optional_lines += extra_concepts['total_lines']244 self.group_optional_lines += extra_concepts['total_lines']
238245
239 if recibo['communication2']:246 if recibo['communication2']:
240 txt_remesa += self._individual_opcional_19(recibo)247 txt_remesa += self._individual_opcional_19(cr,uid,recibo)
241 #self.num_lineas_opc = self.num_lineas_opc + 1
242 self.total_optional_lines += 1248 self.total_optional_lines += 1
243 self.group_optional_lines += 1249 self.group_optional_lines += 1
244 txt_remesa += self._total_ordenante_19()250 txt_remesa += self._total_ordenante_19(cr,uid)
245 else:251 else:
246 # Sólo un ordenante252 # Sólo un ordenante
247 txt_remesa += self._cabecera_ordenante_19()253 txt_remesa += self._cabecera_ordenante_19(cr,uid)
248 self.group_payments = 0254 self.group_payments = 0
249 self.group_optional_lines = 0255 self.group_optional_lines = 0
250 self.group_amount = 0.0256 self.group_amount = 0.0
251257
252 for recibo in lines:258 for recibo in lines:
253 txt_remesa += self._individual_obligatorio_19(recibo)259 txt_remesa += self._individual_obligatorio_19(cr,uid,recibo)
254 self.total_payments += 1260 self.total_payments += 1
255 self.group_payments += 1261 self.group_payments += 1
256 self.group_amount += abs( recibo['amount'] )262 self.group_amount += abs( recibo['amount'] )
257 if order.mode.csb19_extra_concepts:263 if order.mode.csb19_extra_concepts:
258 extra_concepts = self._extra_opcional_19(recibo)264 extra_concepts = self._extra_opcional_19(cr,uid,recibo)
259 txt_remesa += extra_concepts['texto']265 txt_remesa += extra_concepts['texto']
260 self.total_optional_lines += extra_concepts['total_lines']266 self.total_optional_lines += extra_concepts['total_lines']
261 self.group_optional_lines += extra_concepts['total_lines']267 self.group_optional_lines += extra_concepts['total_lines']
262 if recibo['communication2']:268 if recibo['communication2']:
263 txt_remesa += self._individual_opcional_19(recibo)269 txt_remesa += self._individual_opcional_19(cr,uid,recibo)
264 self.total_optional_lines += 1270 self.total_optional_lines += 1
265 self.group_optional_lines += 1271 self.group_optional_lines += 1
266272
267 txt_remesa += self._total_ordenante_19()273 txt_remesa += self._total_ordenante_19(cr,uid)
268274
269 txt_remesa += self._total_general_19()275 txt_remesa += self._total_general_19(cr,uid)
270 return txt_remesa276 return txt_remesa
271277csb_19()
272# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
273\ No newline at end of file278\ No newline at end of file
274279
=== modified file 'l10n_es_payment_order/wizard/csb_32.py'
--- l10n_es_payment_order/wizard/csb_32.py 2011-08-29 15:11:11 +0000
+++ l10n_es_payment_order/wizard/csb_32.py 2013-01-07 16:37:28 +0000
@@ -18,6 +18,9 @@
18# Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 200918# Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 2009
19# Jordi Esteve <jesteve@zikzakmedia.com>19# Jordi Esteve <jesteve@zikzakmedia.com>
20#20#
21# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
22# Ignacio Ibeas <ignacio@acysos.com>
23#
21# This program is free software: you can redistribute it and/or modify24# This program is free software: you can redistribute it and/or modify
22# it under the terms of the GNU Affero General Public License as published by25# it under the terms of the GNU Affero General Public License as published by
23# the Free Software Foundation, either version 3 of the License, or26# the Free Software Foundation, either version 3 of the License, or
@@ -33,20 +36,22 @@
33#36#
34##############################################################################37##############################################################################
3538
39from osv import osv, fields
36from datetime import datetime40from datetime import datetime
37from tools.translate import _41from tools.translate import _
38from converter import *42from log import *
3943
4044class csb_32(osv.osv):
41class csb_32:45 _name = 'csb.32'
4246 _auto = False
43 def _cabecera_fichero_32(self):47 def _cabecera_fichero_32(self, cr, uid):
48 converter = self.pool.get('payment.converter.spain')
44 texto = '0265'49 texto = '0265'
45 texto += ' '50 texto += ' '
46 texto += datetime.today().strftime('%d%m%y')51 texto += datetime.today().strftime('%d%m%y')
47 texto += digits_only( self.order.reference )[-4:]52 texto += converter.digits_only(cr, uid, self.order.reference )[-4:]
48 texto += ' '*3553 texto += ' '*35
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]
50 texto += ' '*655 texto += ' '*6
51 texto += ' '*6156 texto += ' '*61
52 texto += ' '*2457 texto += ' '*24
@@ -55,7 +60,8 @@
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)
56 return texto61 return texto
5762
58 def _cabecera_remesa_32(self, cr, context):63 def _cabecera_remesa_32(self, cr, uid, context):
64 converter = self.pool.get('payment.converter.spain')
59 # A: 65 # A:
60 texto = '1165'66 texto = '1165'
61 texto += ' '67 texto += ' '
@@ -66,42 +72,43 @@
66 texto += ' '*1272 texto += ' '*12
6773
68 # C74 # C
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?
70 texto += '1' # Identificativo de efectos truncados76 texto += '1' # Identificativo de efectos truncados
71 texto += ' '*2177 texto += ' '*21
7278
73 # D79 # D
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 )
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 )
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 )
77 texto += ' ' + ' '*2483 texto += ' ' + ' '*24
78 texto += '\r\n'84 texto += '\r\n'
79 if len(texto) != 152:85 if len(texto) != 152:
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)
81 return texto87 return texto
8288
83 def _registro_individual_i_32(self, cr, recibo, context):89 def _registro_individual_i_32(self, cr, uid, recibo, context):
90 converter = self.pool.get('payment.converter.spain')
84 # A91 # A
85 texto = '2565'92 texto = '2565'
86 texto += ' '93 texto += ' '
87 # B94 # B
88 texto += convert(cr, self.num_recibos+1, 15, context)95 texto += converter.convert(cr, uid, self.num_recibos+1, 15, context)
89 texto += datetime.today().strftime('%d%m%y')96 texto += datetime.today().strftime('%d%m%y')
90 texto += '0001'97 texto += '0001'
91 98
92 # C99 # C
93 state = self.order.mode.bank_id.state_id and self.order.mode.bank_id.state_id.code or False100 state = self.order.mode.bank_id.state_id and self.order.mode.bank_id.state_id.code or False
94 texto += convert(cr, state, 2, context)101 texto += converter.convert(cr, uid, state, 2, context)
95 texto += ' '*7102 texto += ' '*7
96 texto += ' '103 texto += ' '
97104
98 # D105 # D
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)
100 texto += ' '107 texto += ' '
101108
102 # E109 # E
103 texto += ' '*24110 texto += ' '*24
104 texto += convert(cr, abs(recibo['amount']), 9, context)111 texto += converter.convert(cr, uid, abs(recibo['amount']), 9, context)
105 texto += ' '*15112 texto += ' '*15
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')
107 texto += ' '*(6+6+1+4+16)114 texto += ' '*(6+6+1+4+16)
@@ -110,13 +117,14 @@
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)
111 return texto118 return texto
112119
113 def _registro_individual_ii_32(self, cr, recibo, context):120 def _registro_individual_ii_32(self, cr, uid, recibo, context):
121 converter = self.pool.get('payment.converter.spain')
114 # A: Identificacion de la operacion122 # A: Identificacion de la operacion
115 texto = '2665'123 texto = '2665'
116 texto += ' '124 texto += ' '
117125
118 # B: Datos del efecto126 # B: Datos del efecto
119 texto += convert(cr, self.num_recibos+1, 15, context)127 texto += converter.convert(cr, uid, self.num_recibos+1, 15, context)
120 texto += ' '128 texto += ' '
121 texto += '2' # Recibo129 texto += '2' # Recibo
122 texto += '000000'130 texto += '000000'
@@ -132,42 +140,44 @@
132 texto += ' '*20140 texto += ' '*20
133141
134 # D: Datos del efecto142 # D: Datos del efecto
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)
136 texto += convert(cr, recibo['partner_id'].name, 34, context)144 texto += converter.convert(cr, uid, recibo['partner_id'].name, 34, context)
137 texto += ' '*30145 texto += ' '*30
138 texto += '\r\n'146 texto += '\r\n'
139 if len(texto) != 152:147 if len(texto) != 152:
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)
141 return texto149 return texto
142150
143 def _registro_individual_iii_32(self, cr, recibo, context):151 def _registro_individual_iii_32(self, cr, uid, recibo, context):
152 converter = self.pool.get('payment.converter.spain')
144 # A: Identificacion de la operacion153 # A: Identificacion de la operacion
145 texto = '2765'154 texto = '2765'
146 texto += ' '155 texto += ' '
147 156
148 # B: Datos del efecto157 # B: Datos del efecto
149 texto += convert(cr, self.num_recibos+1, 15, context)158 texto += converter.convert(cr, uid, self.num_recibos+1, 15, context)
150 texto += ' '159 texto += ' '
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] )
152 #if not addresses:161 #if not addresses:
153 # print "NO ADDRESSES"162 # print "NO ADDRESSES"
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)
155 texto += convert( cr, address.street, 34, context )164 texto += converter.convert( cr, uid, address.street, 34, context )
156 texto += convert( cr, address.zip, 5, context )165 texto += converter.convert( cr, uid, address.zip, 5, context )
157 texto += convert( cr, address.city, 20, context )166 texto += converter.convert( cr, uid, address.city, 20, context )
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 )
159 texto += '0'*7168 texto += '0'*7
160169
161 # C: Datos del efecto170 # C: Datos del efecto
162 vat = recibo['partner_id'].vat and recibo['partner_id'].vat[2:] or False171 vat = recibo['partner_id'].vat and recibo['partner_id'].vat[2:] or False
163 texto += convert(cr, vat, 9, context)172 texto += converter.convert(cr, uid, vat, 9, context)
164 texto += ' '*50173 texto += ' '*50
165 texto += '\r\n'174 texto += '\r\n'
166 if len(texto) != 152:175 if len(texto) != 152:
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)
168 return texto177 return texto
169178
170 def _registro_fin_remesa_32(self, cr, context):179 def _registro_fin_remesa_32(self, cr, uid, context):
180 converter = self.pool.get('payment.converter.spain')
171 # A: Identificación de la operación181 # A: Identificación de la operación
172 texto = '7165'182 texto = '7165'
173 texto += ' '183 texto += ' '
@@ -182,20 +192,21 @@
182192
183 # D: Acumuladores de importe193 # D: Acumuladores de importe
184 texto += ' '*10194 texto += ' '*10
185 texto += convert( cr, abs(self.order.total), 10, context )195 texto += converter.convert( cr, uid, abs(self.order.total), 10, context )
186 texto += ' '*(10+6+7+6+6+6)196 texto += ' '*(10+6+7+6+6+6)
187197
188 # E: Controles de lectura de fichero198 # E: Controles de lectura de fichero
189 texto += ' '*5199 texto += ' '*5
190 texto += convert(cr, (self.num_recibos*3) + 2, 7, context)200 texto += converter.convert(cr, uid, (self.num_recibos*3) + 2, 7, context)
191 texto += convert(cr, self.num_recibos, 6, context)201 texto += converter.convert(cr, uid, self.num_recibos, 6, context)
192 texto += ' '*6202 texto += ' '*6
193 texto += '\r\n'203 texto += '\r\n'
194 if len(texto) != 152:204 if len(texto) != 152:
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)
196 return texto206 return texto
197207
198 def _registro_fin_fichero_32(self, cr, context):208 def _registro_fin_fichero_32(self, cr, uid, context):
209 converter = self.pool.get('payment.converter.spain')
199 # A: Identificación de la operación210 # A: Identificación de la operación
200 texto = '9865'211 texto = '9865'
201 texto += ' '212 texto += ' '
@@ -208,40 +219,35 @@
208219
209 # D: Acumuladores de importes220 # D: Acumuladores de importes
210 texto += ' '*10221 texto += ' '*10
211 texto += convert( cr, abs(self.order.total), 10, context )222 texto += converter.convert( cr, uid, abs(self.order.total), 10, context )
212 texto += ' '*(10+6+7+6+6+6)223 texto += ' '*(10+6+7+6+6+6)
213224
214 # E: Controles de lectura del fichero225 # E: Controles de lectura del fichero
215 texto += '00001'226 texto += '00001'
216 texto += convert(cr, (self.num_recibos*3) + 3, 7, context)227 texto += converter.convert(cr, uid, (self.num_recibos*3) + 3, 7, context)
217 texto += convert(cr, self.num_recibos, 6, context)228 texto += converter.convert(cr, uid, self.num_recibos, 6, context)
218 texto += ' '*6229 texto += ' '*6
219 texto += '\r\n'230 texto += '\r\n'
220 if len(texto) != 152:231 if len(texto) != 152:
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)
222 return texto233 return texto
223 234
224 def create_file(self, pool, cr, uid, order, lines, context):235 def create_file(self, cr, uid, order, lines, context):
225 self.pool = pool
226 self.cr = cr
227 self.uid = uid
228 self.order = order236 self.order = order
229 self.context = context
230237
231 txt_remesa = ''238 txt_remesa = ''
232 self.num_recibos = 0239 self.num_recibos = 0
233 self.num_lineas_opc = 0240 self.num_lineas_opc = 0
234241
235 txt_remesa += self._cabecera_fichero_32()242 txt_remesa += self._cabecera_fichero_32(cr,uid)
236 txt_remesa += self._cabecera_remesa_32(cr, context)243 txt_remesa += self._cabecera_remesa_32(cr, uid, context)
237 for recibo in lines:244 for recibo in lines:
238 txt_remesa += self._registro_individual_i_32(cr, recibo, context)245 txt_remesa += self._registro_individual_i_32(cr, uid, recibo, context)
239 txt_remesa += self._registro_individual_ii_32(cr, recibo, context)246 txt_remesa += self._registro_individual_ii_32(cr, uid, recibo, context)
240 txt_remesa += self._registro_individual_iii_32(cr, recibo, context)247 txt_remesa += self._registro_individual_iii_32(cr, uid, recibo, context)
241 self.num_recibos = self.num_recibos + 1248 self.num_recibos = self.num_recibos + 1
242 txt_remesa += self._registro_fin_remesa_32(cr, context)249 txt_remesa += self._registro_fin_remesa_32(cr, uid, context)
243 txt_remesa += self._registro_fin_fichero_32(cr, context)250 txt_remesa += self._registro_fin_fichero_32(cr, uid, context)
244 return txt_remesa251 return txt_remesa
245252
246253csb_32()
247# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
248254
=== modified file 'l10n_es_payment_order/wizard/csb_34.py'
--- l10n_es_payment_order/wizard/csb_34.py 2011-09-20 06:47:43 +0000
+++ l10n_es_payment_order/wizard/csb_34.py 2013-01-07 16:37:28 +0000
@@ -20,6 +20,9 @@
20# Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 200920# Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 2009
21# Jordi Esteve <jesteve@zikzakmedia.com>21# Jordi Esteve <jesteve@zikzakmedia.com>
22#22#
23# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
24# Ignacio Ibeas <ignacio@acysos.com>
25#
23# This program is free software: you can redistribute it and/or modify26# This program is free software: you can redistribute it and/or modify
24# it under the terms of the GNU Affero General Public License as published by27# it under the terms of the GNU Affero General Public License as published by
25# the Free Software Foundation, either version 3 of the License, or28# the Free Software Foundation, either version 3 of the License, or
@@ -35,21 +38,17 @@
35#38#
36##############################################################################39##############################################################################
3740
41from osv import osv, fields
38from datetime import datetime42from datetime import datetime
39from tools.translate import _43from tools.translate import _
40from converter import *44from log import *
41import time45import time
4246
43csb34_code = {47class csb_34(osv.osv):
44 'transfer': '56',48 _name = 'csb.34'
45 'cheques': '57',49 _auto = False
46 'promissory_note': '58',50
47 'certified_payments': '59',51 def get_message(self, cr, uid, recibo, message=None):
48}
49
50class csb_34:
51
52 def get_message(self, recibo, message=None):
53 """52 """
54 Evaluates an expression and returns its value53 Evaluates an expression and returns its value
55 @param recibo: Order line data54 @param recibo: Order line data
@@ -78,17 +77,19 @@
78 message = message.replace('${' + field + '}', value)77 message = message.replace('${' + field + '}', value)
79 return message78 return message
8079
81 def _start_34(self, cr, context):80 def _start_34(self, cr, uid, context):
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')
82 return converter.convert(cr, uid, self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo, 12, context)
8383
84 def _cabecera_ordenante_34(self, cr, uid, context):84 def _cabecera_ordenante_34(self, cr, uid, context):
85 converter = self.pool.get('payment.converter.spain')
85 today = datetime.today().strftime('%d%m%y')86 today = datetime.today().strftime('%d%m%y')
8687
87 text = ''88 text = ''
8889
89 # Primer tipo90 # Primer tipo
90 text += '0362'91 text += '0362'
91 text += self._start_34(cr, context)92 text += self._start_34(cr, uid, context)
92 text += 12*' '93 text += 12*' '
93 text += '001'94 text += '001'
94 text += today95 text += today
@@ -97,24 +98,23 @@
97 text += planned.strftime('%d%m%y')98 text += planned.strftime('%d%m%y')
98 else:99 else:
99 text += today100 text += today
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)
101 text += convert_bank_account(cr, self.order.mode.bank_id.acc_number, self.order.mode.partner_id.name, context)
102 text += '0'102 text += '0'
103 text += 8*' '103 text += 8*' '
104 text += '\r\n'104 text += '\r\n'
105105
106 # Segundo Tipo106 # Segundo Tipo
107 text += '0362'107 text += '0362'
108 text += self._start_34(cr, context)108 text += self._start_34(cr, uid, context)
109 text += 12*' '109 text += 12*' '
110 text += '002'110 text += '002'
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)
112 text += 5*' '112 text += 5*' '
113 text += '\r\n'113 text += '\r\n'
114114
115 # Tercer Tipo 115 # Tercer Tipo
116 text += '0362'116 text += '0362'
117 text += self._start_34(cr, context)117 text += self._start_34(cr, uid, context)
118 text += 12*' '118 text += 12*' '
119 text += '003'119 text += '003'
120 # Direccion120 # Direccion
@@ -126,17 +126,17 @@
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]
127 else:127 else:
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 )
129 text += convert(cr, address['street'], 36, context)129 text += converter.convert(cr, uid, address['street'], 36, context)
130 text += 5*' '130 text += 5*' '
131 text += '\r\n'131 text += '\r\n'
132132
133 # Cuarto Tipo 133 # Cuarto Tipo
134 text += '0362'134 text += '0362'
135 text += self._start_34(cr, context)135 text += self._start_34(cr, uid, context)
136 text += 12*' '136 text += 12*' '
137 text += '004'137 text += '004'
138 text += convert(cr, address['zip'], 6, context)138 text += converter.convert(cr, uid, address['zip'], 6, context)
139 text += convert(cr, address['city'], 30, context)139 text += converter.convert(cr, uid, address['city'], 30, context)
140 text += 5*' '140 text += 5*' '
141 text += '\r\n'141 text += '\r\n'
142 if len(text)%74 != 0:142 if len(text)%74 != 0:
@@ -145,7 +145,7 @@
145145
146 def _cabecera_nacionales_34(self, cr, uid, context):146 def _cabecera_nacionales_34(self, cr, uid, context):
147 text = '0456'147 text = '0456'
148 text += self._start_34(cr, context)148 text += self._start_34(cr, uid, context)
149 text += 12*' '149 text += 12*' '
150 text += 3*' '150 text += 3*' '
151 text += 41*' '151 text += 41*' '
@@ -155,7 +155,13 @@
155 return text155 return text
156156
157 def _detalle_nacionales_34(self, cr, uid, recibo, csb34_type, context):157 def _detalle_nacionales_34(self, cr, uid, recibo, csb34_type, context):
158 158 converter = self.pool.get('payment.converter.spain')
159 csb34_code = {
160 'transfer': '56',
161 'cheques': '57',
162 'promissory_note': '58',
163 'certified_payments': '59',
164 }
159 address = None165 address = None
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'])
161 if address_ids.get('invoice'):167 if address_ids.get('invoice'):
@@ -169,17 +175,16 @@
169 text = ''175 text = ''
170 text += '06'176 text += '06'
171 text += csb34_code[csb34_type]177 text += csb34_code[csb34_type]
172 text += self._start_34(cr, context)178 text += self._start_34(cr, uid, context)
173 text += convert(cr, recibo['partner_id'].vat, 12, context)179 text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
174 text += '010'180 text += '010'
175 text += convert(cr, abs(recibo['amount']), 12, context)181 text += converter.convert(cr, uid, abs(recibo['amount']), 12, context)
176 #text += convert_bank_account(cr, recibo['bank_id'].acc_number, recibo['partner_id'].name, context)
177182
178 # Si la orden se emite para transferencia183 # Si la orden se emite para transferencia
179 csb34_type = self.order.mode.csb34_type184 csb34_type = self.order.mode.csb34_type
180 if csb34_type == 'transfer':185 if csb34_type == 'transfer':
181 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''186 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
182 ccc = digits_only(ccc)187 ccc = converter.digits_only(cr, uid, ccc)
183 text += ccc[:20].zfill(20)188 text += ccc[:20].zfill(20)
184 # Si la orden se emite para pagaré, cheque o pago certificado189 # Si la orden se emite para pagaré, cheque o pago certificado
185 else:190 else:
@@ -220,10 +225,10 @@
220 # Segundo Registro225 # Segundo Registro
221 text += '06'226 text += '06'
222 text += csb34_code[csb34_type] 227 text += csb34_code[csb34_type]
223 text += self._start_34(cr, context)228 text += self._start_34(cr, uid, context)
224 text += convert(cr, recibo['partner_id'].vat, 12, context)229 text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
225 text += '011'230 text += '011'
226 text += convert(cr, recibo['partner_id'].name, 36, context)231 text += converter.convert(cr, uid, recibo['partner_id'].name, 36, context)
227 text += 5*' '232 text += 5*' '
228 text += '\r\n'233 text += '\r\n'
229234
@@ -236,10 +241,10 @@
236 for (code, street) in lines:241 for (code, street) in lines:
237 text += '06'242 text += '06'
238 text += csb34_code[csb34_type] 243 text += csb34_code[csb34_type]
239 text += self._start_34(cr, context)244 text += self._start_34(cr, uid, context)
240 text += convert(cr, recibo['partner_id'].vat, 12, context)245 text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
241 text += code246 text += code
242 text += convert(cr, street, 36, context)247 text += converter.convert(cr, uid, street, 36, context)
243 text += 5*' '248 text += 5*' '
244 text += '\r\n'249 text += '\r\n'
245250
@@ -247,11 +252,11 @@
247 if address.zip or address.city:252 if address.zip or address.city:
248 text += '06'253 text += '06'
249 text += csb34_code[csb34_type] 254 text += csb34_code[csb34_type]
250 text += self._start_34(cr, context)255 text += self._start_34(cr, uid, context)
251 text += convert(cr, recibo['partner_id'].vat, 12, context)256 text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
252 text += '014'257 text += '014'
253 text += convert(cr, address.zip, 6, context)258 text += converter.convert(cr, uid, address.zip, 6, context)
254 text += convert(cr, address.city, 30, context)259 text += converter.convert(cr, uid, address.city, 30, context)
255 text += 5*' '260 text += 5*' '
256 text += '\r\n'261 text += '\r\n'
257262
@@ -262,13 +267,13 @@
262 # Sexto Registro267 # Sexto Registro
263 text += '06'268 text += '06'
264 text += csb34_code[csb34_type] 269 text += csb34_code[csb34_type]
265 text += self._start_34(cr, context)270 text += self._start_34(cr, uid, context)
266 text += convert(cr, recibo['partner_id'].vat, 12, context)271 text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
267 text += '015'272 text += '015'
268 country_code = address.country_id and address.country_id.code or ''273 country_code = address.country_id and address.country_id.code or ''
269 state = address.state_id and address.state_id.name or ''274 state = address.state_id and address.state_id.name or ''
270 text += convert(cr, country_code, 2, context)275 text += converter.convert(cr, uid, country_code, 2, context)
271 text += convert(cr, state, 34, context)276 text += converter.convert(cr, uid, state, 34, context)
272 text += 5*' '277 text += 5*' '
273 text += '\r\n'278 text += '\r\n'
274279
@@ -278,43 +283,43 @@
278 if self.order.mode.payroll_check:283 if self.order.mode.payroll_check:
279 text += '06'284 text += '06'
280 text += csb34_code[csb34_type] 285 text += csb34_code[csb34_type]
281 text += self._start_34(cr, context)286 text += self._start_34(cr, uid, context)
282 text += convert(cr, recibo['partner_id'].vat, 12, context)287 text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
283 text += '018'288 text += '018'
284 text += convert(cr, recibo['partner_id'].vat, 36, context)289 text += converter.convert(cr, uid, recibo['partner_id'].vat, 36, context)
285 text += 5*' '290 text += 5*' '
286 text += '\r\n'291 text += '\r\n'
287292
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)
289 text += '06'294 text += '06'
290 text += csb34_code[csb34_type] 295 text += csb34_code[csb34_type]
291 text += self._start_34(cr, context)296 text += self._start_34(cr, uid, context)
292 text += convert(cr, recibo['partner_id'].vat, 12, context)297 text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
293 text += '101'298 text += '101'
294 message = self.get_message(recibo, self.order.mode.text1)299 message = self.get_message(cr, uid, recibo, self.order.mode.text1)
295 text += convert(cr, message, 36, context)300 text += converter.convert(cr, uid, message, 36, context)
296 text += 5*' '301 text += 5*' '
297 text += '\r\n'302 text += '\r\n'
298303
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)
300 text += '06'305 text += '06'
301 text += csb34_code[csb34_type] 306 text += csb34_code[csb34_type]
302 text += self._start_34(cr, context)307 text += self._start_34(cr, uid, context)
303 text += convert(cr, recibo['partner_id'].vat, 12, context)308 text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
304 text += '102'309 text += '102'
305 message = self.get_message(recibo, self.order.mode.text2)310 message = self.get_message(cr, uid, recibo, self.order.mode.text2)
306 text += convert(cr, message, 36, context)311 text += converter.convert(cr, uid, message, 36, context)
307 text += 5*' '312 text += 5*' '
308 text += '\r\n'313 text += '\r\n'
309314
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)
311 text += '06'316 text += '06'
312 text += csb34_code[csb34_type] 317 text += csb34_code[csb34_type]
313 text += self._start_34(cr, context)318 text += self._start_34(cr, uid, context)
314 text += convert(cr, recibo['partner_id'].vat, 12, context)319 text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
315 text += '103'320 text += '103'
316 message = self.get_message(recibo, self.order.mode.text3)321 message = self.get_message(cr, uid, recibo, self.order.mode.text3)
317 text += convert(cr, message, 36, context)322 text += converter.convert(cr, uid, message, 36, context)
318 text += 5*' '323 text += 5*' '
319 text += '\r\n'324 text += '\r\n'
320325
@@ -330,10 +335,10 @@
330 message = day+month+year335 message = day+month+year
331 text += '06'336 text += '06'
332 text += csb34_code[csb34_type] 337 text += csb34_code[csb34_type]
333 text += self._start_34(cr, context)338 text += self._start_34(cr, uid, context)
334 text += convert(cr, recibo['partner_id'].vat, 12, context)339 text += converter.convert(cr, uid, recibo['partner_id'].vat, 12, context)
335 text += '910'340 text += '910'
336 text += convert(cr, message, 36, context)341 text += converter.convert(cr, uid, message, 36, context)
337 text += 5*' '342 text += 5*' '
338 text += '\r\n'343 text += '\r\n'
339344
@@ -342,13 +347,14 @@
342 return text347 return text
343348
344 def _totales_nacionales_34(self, cr, uid, values, context):349 def _totales_nacionales_34(self, cr, uid, values, context):
350 converter = self.pool.get('payment.converter.spain')
345 text = '0856'351 text = '0856'
346 text += self._start_34(cr, context)352 text += self._start_34(cr, uid, context)
347 text += 12*' '353 text += 12*' '
348 text += 3*' '354 text += 3*' '
349 text += convert(cr, self.order.total, 12, context)355 text += converter.convert(cr, uid, self.order.total, 12, context)
350 text += convert(cr, values[0], 8, context)356 text += converter.convert(cr, uid, values[0], 8, context)
351 text += convert(cr, values[1], 10, context)357 text += converter.convert(cr, uid, values[1], 10, context)
352 text += 6*' '358 text += 6*' '
353 text += 5*' '359 text += 5*' '
354 text += '\r\n'360 text += '\r\n'
@@ -357,13 +363,14 @@
357 return text363 return text
358364
359 def _total_general_34(self, cr, uid, values, context):365 def _total_general_34(self, cr, uid, values, context):
366 converter = self.pool.get('payment.converter.spain')
360 text = '0962'367 text = '0962'
361 text += self._start_34(cr, context)368 text += self._start_34(cr, uid, context)
362 text += 12*' '369 text += 12*' '
363 text += 3*' '370 text += 3*' '
364 text += convert(cr, self.order.total, 12, context)371 text += converter.convert(cr, uid, self.order.total, 12, context)
365 text += convert(cr, values[0], 8, context)372 text += converter.convert(cr, uid, values[0], 8, context)
366 text += convert(cr, values[1], 10, context)373 text += converter.convert(cr, uid, values[1], 10, context)
367 text += 6*' '374 text += 6*' '
368 text += 5*' '375 text += 5*' '
369 text += '\r\n'376 text += '\r\n'
@@ -371,10 +378,8 @@
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)
372 return text379 return text
373380
374 def create_file(self, pool, cr, uid, order, lines, context):381 def create_file(self, cr, uid, order, lines, context):
375 self.pool = pool
376 self.order = order382 self.order = order
377 self.context = context
378383
379 payment_line_count = 0384 payment_line_count = 0
380 record_count = 0385 record_count = 0
@@ -394,4 +399,4 @@
394 file += self._total_general_34(cr, uid, values, context)399 file += self._total_general_34(cr, uid, values, context)
395 return file400 return file
396401
397# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:402csb_34()
398403
=== modified file 'l10n_es_payment_order/wizard/csb_34_01.py'
--- l10n_es_payment_order/wizard/csb_34_01.py 2012-05-28 19:13:52 +0000
+++ l10n_es_payment_order/wizard/csb_34_01.py 2013-01-07 16:37:28 +0000
@@ -23,6 +23,9 @@
23# Adaptacion de la norma 34-01 para emision de pagos. Validado para La Caixa: 201223# Adaptacion de la norma 34-01 para emision de pagos. Validado para La Caixa: 2012
24# Joan M. Grande <totaler@gmail.com>24# Joan M. Grande <totaler@gmail.com>
25#25#
26# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
27# Ignacio Ibeas <ignacio@acysos.com>
28#
26# This program is free software: you can redistribute it and/or modify29# This program is free software: you can redistribute it and/or modify
27# it under the terms of the GNU Affero General Public License as published by30# it under the terms of the GNU Affero General Public License as published by
28# the Free Software Foundation, either version 3 of the License, or31# the Free Software Foundation, either version 3 of the License, or
@@ -38,22 +41,28 @@
38#41#
39##############################################################################42##############################################################################
4043
44from osv import osv, fields
41from datetime import datetime45from datetime import datetime
42from tools.translate import _46from tools.translate import _
43from converter import *47from log import *
4448
45class csb_34_01:49class csb_34_01(osv.osv):
46 def _start_34(self, cr, context):50 _name = 'csb.3401'
47 return convert(cr, self.order.mode.bank_id.partner_id.vat[2:], 10, context, 'right')51 _auto = False
52
53 def _start_34(self, cr, uid, context):
54 converter = self.pool.get('payment.converter.spain')
55 return converter.convert(cr, uid, self.order.mode.bank_id.partner_id.vat[2:], 10, context, 'right')
4856
49 def _cabecera_ordenante_34(self, cr, uid, context):57 def _cabecera_ordenante_34(self, cr, uid, context):
58 converter = self.pool.get('payment.converter.spain')
50 today = datetime.today().strftime('%d%m%y')59 today = datetime.today().strftime('%d%m%y')
5160
52 text = ''61 text = ''
5362
54 # Primer tipo63 # Primer tipo
55 text += '0356'64 text += '0356'
56 text += self._start_34(cr, context)65 text += self._start_34(cr, uid, context)
57 text += '34016'66 text += '34016'
58 text += 7*' '67 text += 7*' '
59 text += '001'68 text += '001'
@@ -64,7 +73,7 @@
64 else:73 else:
65 text += today74 text += today
66 #text += self.convert(self.order.mode.nombre, 40)75 #text += self.convert(self.order.mode.nombre, 40)
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)
68 text += ccc['bank']77 text += ccc['bank']
69 text += ccc['office']78 text += ccc['office']
70 text += ccc['account']79 text += ccc['account']
@@ -77,17 +86,17 @@
7786
78 # Segundo Tipo 87 # Segundo Tipo
79 text += '0356'88 text += '0356'
80 text += self._start_34(cr, context)89 text += self._start_34(cr, uid, context)
81 text += '34016'90 text += '34016'
82 text += 7*' '91 text += 7*' '
83 text += '002'92 text += '002'
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)
85 text += 7*' '94 text += 7*' '
86 text += '\n'95 text += '\n'
8796
88 # Tercer Tipo 97 # Tercer Tipo
89 text += '0356'98 text += '0356'
90 text += self._start_34(cr, context)99 text += self._start_34(cr, uid, context)
91 text += '34016'100 text += '34016'
92 text += 7*' '101 text += 7*' '
93 text += '003'102 text += '003'
@@ -97,35 +106,34 @@
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 )
98107
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']
100 text += convert(cr, street, 36, context)109 text += converter.convert(cr, uid, street, 36, context)
101 text += 7*' '110 text += 7*' '
102 text += '\n'111 text += '\n'
103112
104 # Cuarto Tipo 113 # Cuarto Tipo
105 text += '0356'114 text += '0356'
106 text += self._start_34(cr, context)115 text += self._start_34(cr, uid, context)
107 text += '34016'116 text += '34016'
108 text += 7*' '117 text += 7*' '
109 text += '004'118 text += '004'
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']
111 text += convert(cr, city, 36, context)120 text += converter.convert(cr, uid, city, 36, context)
112 text += 7*' '121 text += 7*' '
113 text += '\n'122 text += '\n'
114 return text123 return text
115124
116 def _detalle_nacionales_34(self, cr, uid, recibo, context):125 def _detalle_nacionales_34(self, cr, uid, recibo, context):
126 converter = self.pool.get('payment.converter.spain')
117 # Primer Registro127 # Primer Registro
118 text = ''128 text = ''
119 text += '0656'129 text += '0656'
120 text += self._start_34(cr, context)130 text += self._start_34(cr, uid, context)
121 if not recibo['partner_id'].vat:131 if not recibo['partner_id'].vat:
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 )
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')
124 text += '010'134 text += '010'
125 text += convert(cr, recibo['amount'], 12, context)135 text += converter.convert(cr, uid, recibo['amount'], 12, context)
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)
127 #ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
128 ccc = bank_account_parts(cr, recibo['bank_id'].acc_number, recibo['partner_id'].name, context)
129 text += ccc['bank']137 text += ccc['bank']
130 text += ccc['office']138 text += ccc['office']
131 text += ccc['account']139 text += ccc['account']
@@ -138,33 +146,32 @@
138146
139 # Segundo Registro147 # Segundo Registro
140 text += '0656'148 text += '0656'
141 text += self._start_34(cr, context)149 text += self._start_34(cr, uid, context)
142 if not recibo['partner_id'].vat:150 if not recibo['partner_id'].vat:
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 )
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')
145 text += '011'153 text += '011'
146 text += convert(cr, recibo['partner_id'].name, 36, context)154 text += converter.convert(cr, uid, recibo['partner_id'].name, 36, context)
147 text += 7*' '155 text += 7*' '
148 text += '\n'156 text += '\n'
149 return text157 return text
150158
151 def _totales_nacionales_34(self, cr, uid, context):159 def _totales_nacionales_34(self, cr, uid, context):
160 converter = self.pool.get('payment.converter.spain')
152 text = '0856'161 text = '0856'
153 text += self._start_34(cr, context)162 text += self._start_34(cr, uid, context)
154 text += 12*' '163 text += 12*' '
155 text += 3*' '164 text += 3*' '
156 text += convert(cr, self.order.total, 12, context)165 text += converter.convert(cr, uid, self.order.total, 12, context)
157 text += convert(cr, self.payment_line_count, 8, context)166 text += converter.convert(cr, uid, self.payment_line_count, 8, context)
158 text += convert(cr, self.record_count, 10, context)167 text += converter.convert(cr, uid, self.record_count, 10, context)
159 text += 6*' '168 text += 6*' '
160 text += 7*' '169 text += 7*' '
161 text += '\n'170 text += '\n'
162 return text171 return text
163172
164 def create_file(self, pool, cr, uid, order, lines, context):173 def create_file(self, cr, uid, order, lines, context):
165 self.pool = pool
166 self.order = order174 self.order = order
167 self.context = context
168175
169 self.payment_line_count = 0176 self.payment_line_count = 0
170 self.record_count = 0177 self.record_count = 0
@@ -181,4 +188,4 @@
181 188
182 return file189 return file
183190
184# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:191csb_34_01()
185192
=== modified file 'l10n_es_payment_order/wizard/csb_58.py'
--- l10n_es_payment_order/wizard/csb_58.py 2011-08-29 15:11:11 +0000
+++ l10n_es_payment_order/wizard/csb_58.py 2013-01-07 16:37:28 +0000
@@ -18,6 +18,9 @@
18# Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 200918# Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 2009
19# Jordi Esteve <jesteve@zikzakmedia.com>19# Jordi Esteve <jesteve@zikzakmedia.com>
20#20#
21# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
22# Ignacio Ibeas <ignacio@acysos.com>
23#
21# This program is free software: you can redistribute it and/or modify24# This program is free software: you can redistribute it and/or modify
22# it under the terms of the GNU Affero General Public License as published by25# it under the terms of the GNU Affero General Public License as published by
23# the Free Software Foundation, either version 3 of the License, or26# the Free Software Foundation, either version 3 of the License, or
@@ -33,19 +36,24 @@
33#36#
34##############################################################################37##############################################################################
3538
39from osv import osv, fields
36from datetime import datetime40from datetime import datetime
37from tools.translate import _41from tools.translate import _
38from converter import *42from log import *
3943
40class csb_58:44class csb_58(osv.osv):
41 def _cabecera_presentador_58(self):45 _name = 'csb.58'
46 _auto = False
47
48 def _cabecera_presentador_58(self, cr, uid):
49 converter = self.pool.get('payment.converter.spain')
42 texto = '5170'50 texto = '5170'
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)
44 texto += datetime.today().strftime('%d%m%y')52 texto += datetime.today().strftime('%d%m%y')
45 texto += 6*' '53 texto += 6*' '
46 texto += to_ascii(self.order.mode.nombre).ljust(40)54 texto += converter.to_ascii(cr, uid, self.order.mode.nombre).ljust(40)
47 texto += 20*' '55 texto += 20*' '
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)
49 texto += cc[0:8]57 texto += cc[0:8]
50 texto += 66*' '58 texto += 66*' '
51 texto += '\r\n'59 texto += '\r\n'
@@ -53,32 +61,34 @@
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)
54 return texto62 return texto
5563
56 def _cabecera_ordenante_58(self):64 def _cabecera_ordenante_58(self, cr, uid):
65 converter = self.pool.get('payment.converter.spain')
57 texto = '5370'66 texto = '5370'
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)
59 texto += datetime.today().strftime('%d%m%y')68 texto += datetime.today().strftime('%d%m%y')
60 texto += 6*' '69 texto += 6*' '
61 texto += to_ascii(self.order.mode.nombre).ljust(40)70 texto += converter.to_ascii(cr, uid, self.order.mode.nombre).ljust(40)
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)
63 texto += cc[0:20]72 texto += cc[0:20]
64 texto += 8*' '73 texto += 8*' '
65 texto += '06'74 texto += '06'
66 texto += 52*' '75 texto += 52*' '
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*' '
68 texto += 3*' '77 texto += 3*' '
69 texto += '\r\n'78 texto += '\r\n'
70 if len(texto) != 164:79 if len(texto) != 164:
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)
72 return texto81 return texto
7382
74 def _individual_obligatorio_58(self, recibo):83 def _individual_obligatorio_58(self, cr, uid, recibo):
84 converter = self.pool.get('payment.converter.spain')
75 texto = '5670'85 texto = '5670'
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)
77 texto += str(recibo['name'])[-12:].zfill(12)87 texto += str(recibo['name'])[-12:].zfill(12)
78 nombre = to_ascii(recibo['partner_id'].name)88 nombre = converter.to_ascii(cr, uid, recibo['partner_id'].name)
79 texto += nombre[0:40].ljust(40)89 texto += nombre[0:40].ljust(40)
80 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''90 ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
81 ccc = digits_only(ccc)91 ccc = converter.digits_only(cr, uid, ccc)
82 texto += str(ccc)[0:20].zfill(20)92 texto += str(ccc)[0:20].zfill(20)
83 importe = int(round(abs(recibo['amount'])*100,0))93 importe = int(round(abs(recibo['amount'])*100,0))
84 texto += str(importe).zfill(10)94 texto += str(importe).zfill(10)
@@ -86,7 +96,7 @@
86 concepto = ''96 concepto = ''
87 if recibo['communication']:97 if recibo['communication']:
88 concepto = recibo['communication']98 concepto = recibo['communication']
89 texto += to_ascii(concepto)[0:40].ljust(40)99 texto += converter.to_ascii(cr, uid, concepto)[0:40].ljust(40)
90 if recibo.get('date'):100 if recibo.get('date'):
91 date_cargo = datetime.strptime(recibo['date'],'%Y-%m-%d')101 date_cargo = datetime.strptime(recibo['date'],'%Y-%m-%d')
92 elif recibo.get('ml_maturity_date'):102 elif recibo.get('ml_maturity_date'):
@@ -100,19 +110,20 @@
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)
101 return texto111 return texto
102112
103 def _individual_opcional_58(self, recibo):113 def _individual_opcional_58(self, cr, uid, recibo):
104 """Para poner el segundo texto de comunicación"""114 """Para poner el segundo texto de comunicación"""
115 converter = self.pool.get('payment.converter.spain')
105 texto = '5671'116 texto = '5671'
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)
107 texto += str(recibo['name'])[-12:].zfill(12)118 texto += str(recibo['name'])[-12:].zfill(12)
108 texto += to_ascii(recibo['communication2'])[0:134].ljust(134)119 texto += converter.to_ascii(cr, uid, recibo['communication2'])[0:134].ljust(134)
109 texto += '\r\n'120 texto += '\r\n'
110 if len(texto) != 164:121 if len(texto) != 164:
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)
112 return texto123 return texto
113124
114125
115 def _registro_obligatorio_domicilio_58(self, recibo):126 def _registro_obligatorio_domicilio_58(self, cr, uid, recibo):
116 """127 """
117 Registro obligatorio domicilio 58 para no domiciliados.128 Registro obligatorio domicilio 58 para no domiciliados.
118 129
@@ -134,7 +145,7 @@
134 (DDMMAA)145 (DDMMAA)
135 F2 Libre 155 8 Alfanumérico146 F2 Libre 155 8 Alfanumérico
136 """147 """
137148 converter = self.pool.get('payment.converter.spain')
138 alt_format = self.order.mode.alt_domicile_format149 alt_format = self.order.mode.alt_domicile_format
139150
140 #151 #
@@ -207,10 +218,10 @@
207 texto = '5676'218 texto = '5676'
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)
209 texto += str(recibo['name'])[-12:].zfill(12)220 texto += str(recibo['name'])[-12:].zfill(12)
210 texto += to_ascii(st)[:40].ljust(40) # Domicilio221 texto += converter.to_ascii(cr, uid, st)[:40].ljust(40) # Domicilio
211 texto += to_ascii(city)[:35].ljust(35) # Plaza (ciudad)222 texto += converter.to_ascii(cr, uid, city)[:35].ljust(35) # Plaza (ciudad)
212 texto += to_ascii(zip)[:5].zfill(5) # CP223 texto += converter.to_ascii(cr, uid, zip)[:5].zfill(5) # CP
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)
214 if alt_format:225 if alt_format:
215 #226 #
216 # Si usamos el formato alternativo (basado en FacturaPlus)227 # Si usamos el formato alternativo (basado en FacturaPlus)
@@ -223,7 +234,7 @@
223 texto += date_ct.strftime('%d%m%y') # Fecha crédito234 texto += date_ct.strftime('%d%m%y') # Fecha crédito
224 texto += 2*' '235 texto += 2*' '
225 else:236 else:
226 texto += to_ascii(ord_state_code)[:2].zfill(2) # Cod prov del ordenante237 texto += converter.to_ascii(cr, uid, ord_state_code)[:2].zfill(2) # Cod prov del ordenante
227 texto += date_ct.strftime('%d%m%y') # Fecha crédito238 texto += date_ct.strftime('%d%m%y') # Fecha crédito
228 texto += 8*' ' # Libre239 texto += 8*' ' # Libre
229 texto += '\r\n'240 texto += '\r\n'
@@ -232,7 +243,7 @@
232 return texto243 return texto
233244
234245
235 def _total_ordenante_58(self):246 def _total_ordenante_58(self, cr, uid):
236 texto = '5870'247 texto = '5870'
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)
238 texto += 72*' '249 texto += 72*' '
@@ -247,7 +258,7 @@
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)
248 return texto259 return texto
249260
250 def _total_general_58(self):261 def _total_general_58(self, cr, uid):
251 texto = '5970'262 texto = '5970'
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)
253 texto += 52*' '264 texto += 52*' '
@@ -264,39 +275,34 @@
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)
265 return texto276 return texto
266277
267 def create_file(self, pool, cr, uid, order, lines, context):278 def create_file(self, cr, uid, order, lines, context):
268 self.pool = pool
269 self.cr = cr
270 self.uid = uid
271 self.order = order279 self.order = order
272 self.context = context
273280
274 txt_remesa = ''281 txt_remesa = ''
275 self.num_recibos = 0282 self.num_recibos = 0
276 self.num_lineas_opc = 0283 self.num_lineas_opc = 0
277284
278 txt_remesa += self._cabecera_presentador_58()285 txt_remesa += self._cabecera_presentador_58(cr, uid)
279 txt_remesa += self._cabecera_ordenante_58()286 txt_remesa += self._cabecera_ordenante_58(cr, uid)
280287
281 for recibo in lines:288 for recibo in lines:
282 txt_remesa += self._individual_obligatorio_58(recibo)289 txt_remesa += self._individual_obligatorio_58(cr, uid, recibo)
283 self.num_recibos = self.num_recibos + 1290 self.num_recibos = self.num_recibos + 1
284 291
285 # Sólo emitimos el registro individual si communication2 contiene texto292 # Sólo emitimos el registro individual si communication2 contiene texto
286 if recibo['communication2'] and len(recibo['communication2'].strip()) > 0:293 if recibo['communication2'] and len(recibo['communication2'].strip()) > 0:
287 txt_remesa += self._individual_opcional_58(recibo)294 txt_remesa += self._individual_opcional_58(cr, uid, recibo)
288 self.num_lineas_opc = self.num_lineas_opc + 1295 self.num_lineas_opc = self.num_lineas_opc + 1
289296
290 # Para recibos no domiciliados, añadimos el registro obligatorio297 # Para recibos no domiciliados, añadimos el registro obligatorio
291 # de domicilio (necesario con algunos bancos/cajas).298 # de domicilio (necesario con algunos bancos/cajas).
292 if self.order.mode.inc_domicile:299 if self.order.mode.inc_domicile:
293 txt_remesa += self._registro_obligatorio_domicilio_58(recibo)300 txt_remesa += self._registro_obligatorio_domicilio_58(cr, uid, recibo)
294 self.num_lineas_opc = self.num_lineas_opc + 1301 self.num_lineas_opc = self.num_lineas_opc + 1
295302
296 txt_remesa += self._total_ordenante_58()303 txt_remesa += self._total_ordenante_58(cr, uid)
297 txt_remesa += self._total_general_58()304 txt_remesa += self._total_general_58(cr, uid)
298305
299 return txt_remesa306 return txt_remesa
300307
301308csb_58()
302# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
303309
=== modified file 'l10n_es_payment_order/wizard/export_remesas.py'
--- l10n_es_payment_order/wizard/export_remesas.py 2012-09-08 15:32:47 +0000
+++ l10n_es_payment_order/wizard/export_remesas.py 2013-01-07 16:37:28 +0000
@@ -24,6 +24,9 @@
24# Migración de wizard.interface para la 6.1: Pexego Sistemas Informáticos. 201224# Migración de wizard.interface para la 6.1: Pexego Sistemas Informáticos. 2012
25# Marta Vázquez Rodríguez <marta@pexego.es>25# Marta Vázquez Rodríguez <marta@pexego.es>
26#26#
27# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
28# Ignacio Ibeas <ignacio@acysos.com>
29#
27# This program is free software: you can redistribute it and/or modify30# This program is free software: you can redistribute it and/or modify
28# it under the terms of the GNU Affero General Public License as published by31# it under the terms of the GNU Affero General Public License as published by
29# the Free Software Foundation, either version 3 of the License, or32# the Free Software Foundation, either version 3 of the License, or
@@ -39,16 +42,12 @@
39#42#
40##############################################################################43##############################################################################
4144
45from osv import osv, fields
42import base6446import base64
43from tools.translate import _47from tools.translate import _
44from converter import *48from log import *
45import csb_1949
46import csb_3250
47import csb_34
48import csb_34_01
49import csb_58
50
51from osv import osv, fields
5251
53class wizard_payment_file_spain(osv.osv_memory):52class wizard_payment_file_spain(osv.osv_memory):
54 _name = 'wizard.payment.file.spain'53 _name = 'wizard.payment.file.spain'
@@ -60,10 +59,10 @@
60 }59 }
6160
62 def create_payment_file(self, cr, uid, ids, context):61 def create_payment_file(self, cr, uid, ids, context):
6362 converter = self.pool.get('payment.converter.spain')
64 txt_remesa = ''63 txt_remesa = ''
65 num_lineas_opc = 064 num_lineas_opc = 0
6665 form_obj = self.browse(cr, uid, ids)[0]
67 try:66 try:
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)
69 if not orden.line_ids:68 if not orden.line_ids:
@@ -72,7 +71,7 @@
72 # Comprobamos que exista número de C.C. y que tenga 20 dígitos71 # Comprobamos que exista número de C.C. y que tenga 20 dígitos
73 if not orden.mode.bank_id:72 if not orden.mode.bank_id:
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 )
75 cc = digits_only(orden.mode.bank_id.acc_number)74 cc = converter.digits_only(cr,uid,orden.mode.bank_id.acc_number)
76 if len(cc) != 20:75 if len(cc) != 20:
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)
7877
@@ -81,7 +80,6 @@
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)
8281
83 recibos = []82 recibos = []
84 form_obj = self.browse(cr, uid, ids)[0]
85 if form_obj.join:83 if form_obj.join:
86 # Lista con todos los partners+bancos diferentes de la remesa84 # Lista con todos los partners+bancos diferentes de la remesa
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,
@@ -125,23 +123,23 @@
125 ccc = line['bank_id'] and line['bank_id'].acc_number or False123 ccc = line['bank_id'] and line['bank_id'].acc_number or False
126 if not ccc:124 if not ccc:
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)
128 ccc = digits_only(ccc)126 ccc = converter.digits_only(cr,uid,ccc)
129 if len(ccc) != 20:127 if len(ccc) != 20:
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)
131129
132 if orden.mode.tipo == 'csb_19':130 if orden.mode.tipo == 'csb_19':
133 csb = csb_19.csb_19()131 csb = self.pool.get('csb.19')
134 elif orden.mode.tipo == 'csb_32':132 elif orden.mode.tipo == 'csb_32':
135 csb = csb_32.csb_32()133 csb = self.pool.get('csb.32')
136 elif orden.mode.tipo == 'csb_34':134 elif orden.mode.tipo == 'csb_34':
137 csb = csb_34.csb_34()135 csb = self.pool.get('csb.34')
138 elif orden.mode.tipo == '34_01':136 elif orden.mode.tipo == '34_01':
139 csb = csb_34_01.csb_34_01() 137 csb = self.pool.get('csb.3401')
140 elif orden.mode.tipo == 'csb_58':138 elif orden.mode.tipo == 'csb_58':
141 csb = csb_58.csb_58()139 csb = self.pool.get('csb.58')
142 else:140 else:
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)
144 txt_remesa = csb.create_file(self.pool, cr, uid, orden, recibos, context)142 txt_remesa = csb.create_file(cr, uid, orden, recibos, context)
145143
146 except Log, log:144 except Log, log:
147 form_obj.write({'note': log,'pay': False})145 form_obj.write({'note': log,'pay': False})
@@ -167,7 +165,6 @@
167165
168 return True166 return True
169wizard_payment_file_spain()167wizard_payment_file_spain()
170# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
171168
172169
173170
174171
=== modified file 'l10n_es_payment_order/wizard/export_remesas_view.xml'
--- l10n_es_payment_order/wizard/export_remesas_view.xml 2012-11-15 16:29:52 +0000
+++ l10n_es_payment_order/wizard/export_remesas_view.xml 2013-01-07 16:37:28 +0000
@@ -29,12 +29,12 @@
29 <field name="target">new</field>29 <field name="target">new</field>
30 </record>30 </record>
31 <record id="action_wizard_payment_file_spain2" model="ir.values">31 <record id="action_wizard_payment_file_spain2" model="ir.values">
32 <field name="object" eval="1" />
32 <field name="name">Create payments file</field>33 <field name="name">Create payments file</field>
33 <field name="key2">client_action_multi</field>34 <field name="key2">client_action_multi</field>
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'))"/>
35 <field name="key">action</field>36 <field name="key">action</field>
36 <field name="model">payment.order</field>37 <field name="model">payment.order</field>
37 </record>38 </record>
38
39 </data>39 </data>
40</openerp>40</openerp>
4141
=== added file 'l10n_es_payment_order/wizard/log.py'
--- l10n_es_payment_order/wizard/log.py 1970-01-01 00:00:00 +0000
+++ l10n_es_payment_order/wizard/log.py 2013-01-07 16:37:28 +0000
@@ -0,0 +1,45 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2006 ACYSOS S.L. (http://acysos.com) All Rights Reserved.
6# Pedro Tarrafeta <pedro@acysos.com>
7# Copyright (c) 2008 Pablo Rocandio. All Rights Reserved.
8# Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
9# Jordi Esteve <jesteve@zikzakmedia.com>
10# Copyright (c) 2009 NaN (http://www.nan-tic.com) All Rights Reserved.
11# Albert Cervera i Areny <albert@nan-tic.com>
12# $Id$
13# Refactorización. Acysos S.L. (http://www.acysos.com) 2012
14# Ignacio Ibeas <ignacio@acysos.com>
15#
16# This program is free software: you can redistribute it and/or modify
17# it under the terms of the GNU Affero General Public License as published by
18# the Free Software Foundation, either version 3 of the License, or
19# (at your option) any later version.
20#
21# This program is distributed in the hope that it will be useful,
22# but WITHOUT ANY WARRANTY; without even the implied warranty of
23# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24# GNU Affero General Public License for more details.
25#
26# You should have received a copy of the GNU Affero General Public License
27# along with this program. If not, see <http://www.gnu.org/licenses/>.
28#
29##############################################################################
30
31from tools.translate import _
32
33class Log(Exception):
34 def __init__(self, content = '', error = False):
35 self.content = content
36 self.error = error
37 def add(self, s, error=True):
38 self.content = self.content + s
39 if error:
40 self.error = error
41 def __call__(self):
42 return self.content
43 def __str__(self):
44 return self.content
45