1
# -*- encoding: utf-8 -*-
2
##############################################################################
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>
14
# Corregido para instalación TinyERP estándar 4.2.0: Zikzakmedia S.L. 2008
15
# Jordi Esteve <jesteve@zikzakmedia.com>
17
# Añadidas cuentas de remesas y tipos de pago. 2008
18
# Pablo Rocandio <salbet@gmail.com>
20
# Rehecho de nuevo para instalación OpenERP 5.0.0 sobre account_payment_extension: Zikzakmedia S.L. 2009
21
# Jordi Esteve <jesteve@zikzakmedia.com>
23
# This program is free software: you can redistribute it and/or modify
24
# it under the terms of the GNU General Public License as published by
25
# the Free Software Foundation, either version 3 of the License, or
26
# (at your option) any later version.
28
# This program is distributed in the hope that it will be useful,
29
# but WITHOUT ANY WARRANTY; without even the implied warranty of
30
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31
# GNU General Public License for more details.
33
# You should have received a copy of the GNU General Public License
34
# along with this program. If not, see <http://www.gnu.org/licenses/>.
36
##############################################################################
38
from datetime import datetime
39
from tools.translate import _
40
from converter import *
43
def _start_34(self, cr, context):
44
return convert(cr, self.order.mode.bank_id.partner_id.vat[2:] + self.order.mode.sufijo, 12, context)
46
def _cabecera_ordenante_34(self, cr, uid, context):
47
today = datetime.today().strftime('%d%m%y')
53
text += self._start_34(cr, context)
57
if self.order.date_planned:
58
planned = datetime.strptime(self.order.date_planned, '%Y-%m-%d')
59
text += planned.strftime('%d%m%y')
62
#text += self.convert(self.order.mode.nombre, 40)
63
text += convert_bank_account(cr, self.order.mode.bank_id.acc_number, self.order.mode.partner_id.name, context)
70
text += self._start_34(cr, context)
73
text += convert(cr, self.order.mode.bank_id.partner_id.name, 36, context)
79
text += self._start_34(cr, context)
83
address_id = self.pool.get('res.partner').address_get(cr, uid, [self.order.mode.bank_id.partner_id.id], ['invoice'])['invoice']
85
raise Log( _('User error:\n\nCompany %s has no invoicing address.') % address_id )
87
street = self.pool.get('res.partner.address').read(cr, uid, [address_id], ['street'], context)[0]['street']
88
text += convert(cr, street, 36, context)
94
text += self._start_34(cr, context)
97
text += convert(cr, self.order.mode.bank_id.street, 36, context)
102
def _cabecera_nacionales_34(self, cr, uid, context):
104
text += self._start_34(cr, context)
111
def _detalle_nacionales_34(self, cr, uid, recibo, context):
115
text += self._start_34(cr, context)
116
text += convert(cr, recibo['partner_id'].vat, 12, context)
118
text += convert(cr, recibo['amount'], 12, context)
119
#text += convert_bank_account(cr, recibo['bank_id'].acc_number, recibo['partner_id'].name, context)
120
ccc = recibo['bank_id'] and recibo['bank_id'].acc_number or ''
121
ccc = digits_only(ccc)
122
text += ccc[:20].zfill(20)
124
text += '9' # Otros conceptos (ni Nomina ni Pension)
131
text += self._start_34(cr, context)
132
text += convert(cr, recibo['partner_id'].vat, 12, context)
134
text += convert(cr, recibo['partner_id'].name, 36, context)
139
def _totales_nacionales_34(self, cr, uid, context):
141
text += self._start_34(cr, context)
144
text += convert(cr, self.order.total, 12, context)
145
text += convert(cr, self.payment_line_count, 8, context)
146
text += convert(cr, 1 + (self.payment_line_count * 2) + 1, 10, context)
152
def _total_general_34(self, cr, uid, context):
154
text += self._start_34(cr, context)
157
text += convert(cr, self.order.total, 12, context)
158
text += convert(cr, self.payment_line_count, 8, context)
159
text += convert(cr, 4 + 1 + (self.payment_line_count * 2 ) + 1 + 1, 10, context)
165
def create_file(self, pool, cr, uid, order, lines, context):
168
self.context = context
170
self.payment_line_count = 0
171
self.record_count = 0
174
file += self._cabecera_ordenante_34(cr, uid, context)
175
file += self._cabecera_nacionales_34(cr, uid, context)
177
file += self._detalle_nacionales_34(cr, uid, recibo, context)
178
self.payment_line_count += 1
179
self.record_count += 2
180
file += self._totales_nacionales_34(cr, uid, context)
181
self.record_count += 1
182
file += self._total_general_34(cr, uid, context)
185
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: