Merge lp:~vauxoo/openerp-venezuela-localization/gaby_bugs_localization into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
- gaby_bugs_localization
- Merge into 6.0-trunk
Status: | Merged |
---|---|
Approved by: | Gabriela Quilarque |
Approved revision: | 444 |
Merge reported by: | Gabriela Quilarque |
Merged at revision: | not available |
Proposed branch: | lp:~vauxoo/openerp-venezuela-localization/gaby_bugs_localization |
Merge into: | lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk |
Diff against target: |
335 lines (+112/-69) 3 files modified
l10n_ve_withholding_iva/__init__.py (+19/-12) l10n_ve_withholding_iva/generate_txt.py (+48/-34) l10n_ve_withholding_iva/generate_txt_view.xml (+45/-23) |
To merge this branch: | bzr merge lp:~vauxoo/openerp-venezuela-localization/gaby_bugs_localization |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Nhomar - Vauxoo | Needs Fixing | ||
Gabriela Quilarque | Approve | ||
Review via email: mp+80523@code.launchpad.net |
Commit message
Description of the change
Refactorizado los archivos generate_txt.py y generate_
para hacer funcionar la generacion del archivo .txt, necesario para ser declaradoante el SENIAT.
Actualmente se encuentra funcionando el modelo y la vista, pero aun no se
genera el archivo .txt, por cambios realizados en OpenERP dela version 5.0 a la versión 6.0
al momento de crear un attachment, el asunto quehay que resolver es el nuevo campo "res_name"
del modelo ir.attachment.
Gabriela Quilarque (gabrielaquilarque97) wrote : | # |
Nhomar - Vauxoo (nhomar) wrote : | # |
Hola Gaby.
Me preocupa que muchos ++ las cadenas estan en español y ya habian sido cambiadas al ingles?
Revisa con detenimiento el diff por favor.
Saludos.
Nhomar - Vauxoo (nhomar) wrote : | # |
Ej.
La lInea 104!
Gabriela Quilarque (gabrielaquilarque97) wrote : | # |
Si Nhomar, estoy al tanto de las cadenas en español, todavia me falta hacer varias cosas para los archivos que involucran generar el txt, recuerda que tuve que volver a hacer la migracion porque no funcionaba el modulo por eso hay muchos ++.
Realice el merge porque tu ibas a comenzar a trabajar con workflow, pero sigo trabajando con generar txt.
Preview Diff
1 | === modified file 'l10n_ve_withholding_iva/__init__.py' |
2 | --- l10n_ve_withholding_iva/__init__.py 2011-10-06 17:08:59 +0000 |
3 | +++ l10n_ve_withholding_iva/__init__.py 2011-10-27 01:00:30 +0000 |
4 | @@ -1,22 +1,29 @@ |
5 | -# -*- coding: utf-8 -*- |
6 | -############################################################################## |
7 | -# |
8 | -# |
9 | -# |
10 | -# |
11 | +#!/usr/bin/python |
12 | +# -*- encoding: utf-8 -*- |
13 | +########################################################################### |
14 | +# Module Writen to OpenERP, Open Source Management Solution |
15 | +# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
16 | +# All Rights Reserved |
17 | +###############Credits###################################################### |
18 | +# Coded by: Humberto Arocha <humberto@openerp.com.ve> |
19 | +# Maria Gabriela Quilarque <gabriela@openerp.com.ve> |
20 | +# Javier Duran <javier@nvauxoo.com> |
21 | +# Planified by: Nhomar Hernandez |
22 | +# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve |
23 | +# Audited by: Humberto Arocha humberto@openerp.com.ve |
24 | +############################################################################# |
25 | # This program is free software: you can redistribute it and/or modify |
26 | -# it under the terms of the GNU Affero General Public License as |
27 | -# published by the Free Software Foundation, either version 3 of the |
28 | -# License, or (at your option) any later version. |
29 | +# it under the terms of the GNU General Public License as published by |
30 | +# the Free Software Foundation, either version 3 of the License, or |
31 | +# (at your option) any later version. |
32 | # |
33 | # This program is distributed in the hope that it will be useful, |
34 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
35 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
36 | -# GNU Affero General Public License for more details. |
37 | +# GNU General Public License for more details. |
38 | # |
39 | -# You should have received a copy of the GNU Affero General Public License |
40 | +# You should have received a copy of the GNU General Public License |
41 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
42 | -# |
43 | ############################################################################## |
44 | import wh_iva |
45 | import account |
46 | |
47 | === modified file 'l10n_ve_withholding_iva/generate_txt.py' |
48 | --- l10n_ve_withholding_iva/generate_txt.py 2011-10-05 22:33:01 +0000 |
49 | +++ l10n_ve_withholding_iva/generate_txt.py 2011-10-27 01:00:30 +0000 |
50 | @@ -34,6 +34,7 @@ |
51 | from xml.etree.ElementTree import Element, SubElement, ElementTree, tostring |
52 | import sys |
53 | import base64 |
54 | +import decimal_precision as dp |
55 | |
56 | class txt_iva(osv.osv): |
57 | _name = "txt.iva" |
58 | @@ -41,38 +42,34 @@ |
59 | #~ def _get_amount_total(self,cr,uid,ids,name,args,context=None): |
60 | #~ res = {} |
61 | #~ for txt in self.browse(cr,uid,ids,context): |
62 | - #~ res[txt.id]=0.0 |
63 | + #~ res[txt.id]= 0.0 |
64 | #~ for txt_line in txt.txt_ids: |
65 | #~ res[txt.id] += txt_line.amount_withheld |
66 | - #~ |
67 | #~ return res |
68 | - |
69 | +#~ |
70 | #~ def _get_amount_total_base(self,cr,uid,ids,name,args,context=None): |
71 | #~ res = {} |
72 | #~ for txt in self.browse(cr,uid,ids,context): |
73 | #~ res[txt.id]= 0.0 |
74 | #~ for txt_line in txt.txt_ids: |
75 | - #~ print 'result: ',res[txt.id] |
76 | - #~ print 'monto: ', txt_line.untaxed |
77 | #~ res[txt.id] += txt_line.untaxed |
78 | - #~ |
79 | #~ return res |
80 | |
81 | _columns = { |
82 | - 'company_id': fields.many2one('res.company', 'Company', required=True, readonly=True,states={'draft':[('readonly',False)]}), |
83 | + 'company_id': fields.many2one('res.company', 'Compañía', required=True, readonly=True,states={'draft':[('readonly',False)]}), |
84 | 'state': fields.selection([ |
85 | ('draft','Draft'), |
86 | ('confirmed', 'Confirmed'), |
87 | ('done','Done'), |
88 | ('cancel','Cancelled') |
89 | - ],'Estado', select=True, readonly=True, help="proof status"), |
90 | - 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True,readonly=True,states={'draft':[('readonly',False)]}), |
91 | - 'period_id':fields.many2one('account.period','Period',required=True,readonly=True,states={'draft':[('readonly',False)]}, domain="[('fiscalyear_id','=',fiscalyear_id)]"), |
92 | - 'type':fields.boolean('Retention Suppliers?',required=True,states={'draft':[('readonly',False)]}, help="Select the type of retention to make"), |
93 | - 'date_start': fields.date('Begin Date',required=True,states={'draft':[('readonly',False)]}, help="Begin date of period"), |
94 | - 'date_end': fields.date('End date', required=True,states={'draft':[('readonly',False)]}, help="End date of period"), |
95 | - 'type':fields.boolean('Retención Proveedores?',required=True,states={'draft':[('readonly',False)]}, help="Select the type of retention to make"), |
96 | - 'txt_ids':fields.one2many('txt.iva.line','txt_id',domain="[('txt_id','=',False)]", readonly=True,states={'draft':[('readonly',False)]}, help='Txt field lines of ar required by SENIAT for VAT withholding'), |
97 | + ],'Estado', select=True, readonly=True, help="Estado del Comprobante"), |
98 | + 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Año Fiscal', required=True,readonly=True,states={'draft':[('readonly',False)]}), |
99 | + 'period_id':fields.many2one('account.period','Periodo',required=True,readonly=True,states={'draft':[('readonly',False)]}, domain="[('fiscalyear_id','=',fiscalyear_id)]"), |
100 | + 'type':fields.boolean('Retención Proveedores?',required=True,states={'draft':[('readonly',False)]}, help="Seleccione el tipo de retencion a realizar"), |
101 | + 'date_start': fields.date('Fecha Inicio',required=True,states={'draft':[('readonly',False)]}, help="Fecha de Inicio del periodo"), |
102 | + 'date_end': fields.date('Fecha Fin', required=True,states={'draft':[('readonly',False)]}, help="Fecha de Fin del periodo"), |
103 | + 'type':fields.boolean('Retención Proveedores?',required=True,states={'draft':[('readonly',False)]}, help="Seleccione el tipo de retencion a realizar"), |
104 | + 'txt_ids':fields.one2many('txt.iva.line','txt_id', readonly=True,states={'draft':[('readonly',False)]}, help='Lineas del archivo txt exigido por el SENIAT, para retención del IVA'), |
105 | #~ 'amount_total_ret':fields.function(_get_amount_total,method=True, digits=(16, 2), readonly=True, string=' Total Monto de Retencion', help="Monto Total Retenido"), |
106 | #~ 'amount_total_base':fields.function(_get_amount_total_base,method=True, digits=(16, 2), readonly=True, string='Total Base Imponible', help="Total de la Base Imponible"), |
107 | } |
108 | @@ -107,9 +104,7 @@ |
109 | voucher_ids = voucher_obj.search(cr,uid,[('date_ret','>=',txt_brw.date_start),('date_ret','<=',txt_brw.date_end),('period_id','=',txt_brw.period_id.id),('state','=','done'),('type','in',['out_invoice','out_refund'])]) |
110 | |
111 | for voucher in voucher_obj.browse(cr,uid,voucher_ids): |
112 | - |
113 | - for voucher_lines in voucher.retention_line: |
114 | - |
115 | + for voucher_lines in voucher.wh_lines: |
116 | if voucher_lines.invoice_id.state in ['open','paid']: |
117 | txt_iva_obj.create(cr,uid, |
118 | {'partner_id':voucher.partner_id.id, |
119 | @@ -160,7 +155,7 @@ |
120 | number=0 |
121 | if txt_line.invoice_id.type in ['in_invoice','in_refund']: |
122 | if not txt_line.invoice_id.reference: |
123 | - raise osv.except_osv(_('Invalid action !'),_("Unable to make txt file, because the bill has no reference number free!")) |
124 | + raise osv.except_osv(_('Invalid action !'),_("Imposible realizar archivo txt, debido a que la factura no tiene numero de referencia libre!")) |
125 | else: |
126 | number = self.get_number(cr,uid,txt_line.invoice_id.reference.strip(),inv_type,20) |
127 | elif txt_line.invoice_id.number: |
128 | @@ -213,33 +208,40 @@ |
129 | document_type = self.get_type_document(cr,uid,txt_line) |
130 | document_number=self.get_document_number(cr,uid,ids,txt_line,'inv_number',context) |
131 | control_number = self.get_number(cr,uid,txt_line.invoice_id.nro_ctrl,'inv_ctrl',20) |
132 | - document_affected= self.get_document_affected(cr,uid,txt_line,context) |
133 | + #~ document_affected= self.get_document_affected(cr,uid,txt_line,context) |
134 | voucher_number = self.get_number(cr,uid,txt_line.voucher_id.number,'vou_number',14) |
135 | amount_exempt,amount_untaxed = self.get_amount_exempt_document(cr,uid,txt_line) |
136 | alicuota = self.get_alicuota(cr,uid,txt_line) |
137 | |
138 | - txt_string= txt_string + buyer +'\t'+period2.strip()+'\n' |
139 | - #~ +'\t'\ |
140 | + #~ txt_string= txt_string + buyer +'\t'+period2.strip()+'\t'\ |
141 | #~ +txt_line.invoice_id.date_invoice+'\t'+operation_type+'\t'+document_type+'\t'+vendor+'\t'\ |
142 | #~ +document_number+'\t'+control_number+'\t'+str(round(txt_line.invoice_id.amount_total,2))+'\t'\ |
143 | #~ +str(round(amount_untaxed,2))+'\t'\ |
144 | #~ +str(round(txt_line.amount_withheld,2))+'\t'+document_affected+'\t'+voucher_number+'\t'\ |
145 | #~ +str(round(amount_exempt,2))+'\t'+str(alicuota)+'\t'+'0'\ |
146 | - |
147 | + #~ +'\n' |
148 | + txt_string= txt_string + buyer +'\t'+period2.strip()+'\t'\ |
149 | + +txt_line.invoice_id.date_invoice+'\t'+operation_type+'\t'+document_type+'\t'+vendor+'\t'\ |
150 | + +document_number+'\t'+control_number+'\t'+str(round(txt_line.invoice_id.amount_total,2))+'\t'\ |
151 | + +str(round(amount_untaxed,2))+'\t'\ |
152 | + +str(round(txt_line.amount_withheld,2))+'\t'+'\t'+voucher_number+'\t'\ |
153 | + +str(round(amount_exempt,2))+'\t'+str(alicuota)+'\t'+'0'\ |
154 | + +'\n' |
155 | return txt_string |
156 | |
157 | def _write_attachment(self, cr,uid,ids,root,context): |
158 | ''' |
159 | - Encrypt txt, save it to the db and view it on the client as an attachment |
160 | + Codificar el txt, para guardarlo en la bd y poder verlo en el cliente como attachment |
161 | ''' |
162 | fecha = time.strftime('%Y_%m_%d') |
163 | - name = 'IVA_' + fecha +'.'+ 'txt' |
164 | + name_file = 'IVA_' + fecha +'.'+ 'txt' |
165 | self.pool.get('ir.attachment').create(cr, uid, { |
166 | - 'name': name, |
167 | + 'name': name_file, |
168 | 'datas': base64.encodestring(root), |
169 | - 'datas_fname': name, |
170 | + 'datas_fname': name_file, |
171 | 'res_model': 'txt.iva', |
172 | 'res_id': ids[0], |
173 | + 'type':'binary', |
174 | }, context=context |
175 | ) |
176 | cr.commit() |
177 | @@ -251,13 +253,25 @@ |
178 | _name = "txt.iva.line" |
179 | |
180 | _columns = { |
181 | - 'partner_id':fields.many2one('res.partner','Buyer/Seller',help="Natural or juridical person that generates the Invoice, Credit Note, Debit Note or C ertification (seller)"), |
182 | - 'invoice_id':fields.many2one('account.invoice','Bill/ND/NC',help="Date of invoice, credit note, debit note or certificate, I mportación Statement"), |
183 | - 'voucher_id':fields.many2one('account.wh.iva','Tax Withholding',help="Withholding of Value Added Tax (VAT)"), |
184 | - 'amount_withheld':fields.float('Amount Withheld'), |
185 | - 'untaxed':fields.float('Untaxed'), |
186 | - 'txt_id':fields.many2one('txt.iva','Generate-Document txt VAT'), |
187 | + 'partner_id':fields.many2one('res.partner','Comprador/Vendedor',help="Persona jurídica ó natural que genera la Factura, Nota de Crédito, Nota de Débito o Certificación (vendedor)"), |
188 | + 'invoice_id':fields.many2one('account.invoice','Factura/ND/NC',help="Fecha de la factura, Nota de Crédito, Nota de Débito o Certificación, Declaración de Importación"), |
189 | + 'voucher_id':fields.many2one('account.wh.iva','Comprobante de Retencion IVA',help="Comprobante de Retencion de Impuesto al Valor Agregado (IVA)"), |
190 | + 'amount_withheld':fields.float('Amount Withheld',digits_compute= dp.get_precision('Withhold')), |
191 | + 'untaxed':fields.float('Untaxed',digits_compute= dp.get_precision('Withhold')), |
192 | + 'txt_id':fields.many2one('txt.iva','Documento-Generar txt IVA'), |
193 | } |
194 | _rec_name = 'partner_id' |
195 | - |
196 | + |
197 | txt_iva_line() |
198 | + |
199 | + |
200 | + |
201 | + |
202 | + |
203 | + |
204 | + |
205 | + |
206 | + |
207 | + |
208 | + |
209 | + |
210 | |
211 | === modified file 'l10n_ve_withholding_iva/generate_txt_view.xml' |
212 | --- l10n_ve_withholding_iva/generate_txt_view.xml 2011-10-05 22:33:01 +0000 |
213 | +++ l10n_ve_withholding_iva/generate_txt_view.xml 2011-10-27 01:00:30 +0000 |
214 | @@ -8,12 +8,42 @@ |
215 | ===================================================== |
216 | --> |
217 | |
218 | + <record id="view_generate_txt_iva_line_tree" model="ir.ui.view"> |
219 | + <field name="name">generate.txt.iva.line.tree</field> |
220 | + <field name="model">txt.iva.line</field> |
221 | + <field name="type">tree</field> |
222 | + <field name="arch" type="xml"> |
223 | + <tree string="Lineas del archivo TXT"> |
224 | + <field name="partner_id"/> |
225 | + <field name="invoice_id"/> |
226 | + <field name="voucher_id"/> |
227 | + <field name="untaxed"/> |
228 | + <field name="amount_withheld"/> |
229 | + </tree> |
230 | + </field> |
231 | + </record> |
232 | + |
233 | + <record id="view_generate_txt_iva_line_form" model="ir.ui.view"> |
234 | + <field name="name">generate.txt.iva.line.form</field> |
235 | + <field name="model">txt.iva.line</field> |
236 | + <field name="type">form</field> |
237 | + <field name="arch" type="xml"> |
238 | + <form string="Detalle de las Lineas de Retencion para TXT"> |
239 | + <field name="partner_id"/> |
240 | + <field name="invoice_id"/> |
241 | + <field name="voucher_id"/> |
242 | + <field name="untaxed"/> |
243 | + <field name="amount_withheld"/> |
244 | + </form> |
245 | + </field> |
246 | + </record> |
247 | + |
248 | <record id="view_generate_txt_iva_tree" model="ir.ui.view"> |
249 | <field name="name">generate.txt.iva.tree</field> |
250 | <field name="model">txt.iva</field> |
251 | <field name="type">tree</field> |
252 | <field name="arch" type="xml"> |
253 | - <tree string="Field TXT"> |
254 | + <tree string="Archivo TXT"> |
255 | <field name="company_id"/> |
256 | <field name="fiscalyear_id"/> |
257 | <field name="period_id"/> |
258 | @@ -27,7 +57,7 @@ |
259 | <field name="model">txt.iva</field> |
260 | <field name="type">form</field> |
261 | <field name="arch" type="xml"> |
262 | - <form string="Withholding lines for TXT"> |
263 | + <form string="Lineas de Retencion para TXT"> |
264 | <group col="4" colspan="4"> |
265 | <field name="company_id"/> |
266 | <field name="type"/> |
267 | @@ -43,22 +73,14 @@ |
268 | <field name="date_end"/> |
269 | </group> |
270 | <notebook colspan="4"> |
271 | - <page string="Withholding lines"> |
272 | - <field name="txt_ids" nolabel="1" colspan='4' widget="one2many_list"> |
273 | - <tree string="Field of lines TXT"> |
274 | - <field name="partner_id"/> |
275 | - <field name="invoice_id"/> |
276 | - <field name="voucher_id"/> |
277 | - <field name="untaxed"/> |
278 | - <field name="amount_withheld"/> |
279 | - </tree> |
280 | - </field> |
281 | + <page string="Lineas de Retencion"> |
282 | + <field name="txt_ids" nolabel="1" colspan='4' widget="one2many_list"/> |
283 | <group col="4" colspan="2"> |
284 | <field name="state" select="2" colspan="4"/> |
285 | - <button name="action_generate_lines_txt" string="Lines Generate TXT" states="draft" type="object" icon="gtk-go-forward" colspan="4"/> |
286 | - <button name="action_confirm" string="Confirm" states="draft" type="object" icon="gtk-go-forward" colspan="4"/> |
287 | - <button name="action_done" string="Make TXT" states="confirmed" type="object" icon="gtk-ok"/> |
288 | - <button name="action_anular" string="Canlce" states="confirmed,done" type="object" icon="gtk-cancel"/> |
289 | + <button name="action_generate_lines_txt" string="Generar Lineas TXT" states="draft" type="object" icon="gtk-go-forward" colspan="4"/> |
290 | + <button name="action_confirm" string="Confirmar" states="draft" type="object" icon="gtk-go-forward" colspan="4"/> |
291 | + <button name="action_done" string="Realizar TXT" states="confirmed" type="object" icon="gtk-ok"/> |
292 | + <button name="action_anular" string="Anular" states="confirmed,done" type="object" icon="gtk-cancel"/> |
293 | </group> |
294 | <!-- |
295 | <group col="2" colspan="2"> |
296 | @@ -72,32 +94,32 @@ |
297 | </field> |
298 | </record> |
299 | |
300 | - <record model="ir.actions.act_window" id="action_generate_text_iva"> |
301 | - <field name="name">Generate TXT</field> |
302 | + |
303 | + <record model="ir.actions.act_window" id="action_generate_txt_iva"> |
304 | + <field name="name">Generar TXT</field> |
305 | <field name="res_model">txt.iva</field> |
306 | <field name="type">ir.actions.act_window</field> |
307 | <field name="view_type">form</field> |
308 | <field name="view_mode">tree,form</field> |
309 | </record> |
310 | - |
311 | + |
312 | <record model="ir.actions.act_window.view" id="action_generate_txt_iva_tree"> |
313 | <field name="sequence" eval="10"/> |
314 | <field name="view_mode">tree</field> |
315 | <field name="view_id" ref="view_generate_txt_iva_tree"/> |
316 | - <field name="act_window_id" ref="action_generate_text_iva"/> |
317 | + <field name="act_window_id" ref="action_generate_txt_iva"/> |
318 | </record> |
319 | - |
320 | <record model="ir.actions.act_window.view" id="action_generate_txt_iva_form"> |
321 | <field name="sequence" eval="20"/> |
322 | <field name="view_mode">form</field> |
323 | <field name="view_id" ref="view_generate_txt_iva_form"/> |
324 | - <field name="act_window_id" ref="action_generate_text_iva"/> |
325 | + <field name="act_window_id" ref="action_generate_txt_iva"/> |
326 | </record> |
327 | |
328 | <menuitem name="Generate TXT" |
329 | id="menu_action_generate_txt_iva" |
330 | parent="l10n_ve_fiscal_requirements.menu_venezuela_reporting" |
331 | - action="action_generate_text_iva"/> |
332 | + action="action_generate_txt_iva"/> |
333 | |
334 | </data> |
335 | </openerp> |
Merge Done.