Merge lp:~vauxoo/openerp-venezuela-localization/miguel-retencion-iva into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk

Proposed by Miguel Delgado (Vauxoo)
Status: Merged
Merged at revision: 396
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/miguel-retencion-iva
Merge into: lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
Diff against target: 760 lines (+647/-8) (has conflicts)
9 files modified
l10n_ve_withholding_iva/__init__.py (+2/-0)
l10n_ve_withholding_iva/__openerp__.py (+10/-2)
l10n_ve_withholding_iva/generate_txt.py (+263/-0)
l10n_ve_withholding_iva/generate_txt_view.xml (+108/-0)
l10n_ve_withholding_iva/partner.py (+8/-6)
l10n_ve_withholding_iva/report/__init__.py (+30/-0)
l10n_ve_withholding_iva/report/list_wh_iva.py (+54/-0)
l10n_ve_withholding_iva/report/list_wh_iva_report.rml (+157/-0)
l10n_ve_withholding_iva/txt_wh_report.xml (+15/-0)
Text conflict in l10n_ve_withholding_iva/__openerp__.py
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/miguel-retencion-iva
Reviewer Review Type Date Requested Status
Nhomar - Vauxoo Pending
Review via email: mp+77951@code.launchpad.net

Description of the change

add to the l10n_ve_withholding_iva the property to generate the iva txt

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'l10n_ve_withholding_iva/__init__.py'
--- l10n_ve_withholding_iva/__init__.py 2011-10-01 01:22:41 +0000
+++ l10n_ve_withholding_iva/__init__.py 2011-10-03 14:54:19 +0000
@@ -22,6 +22,8 @@
22import account22import account
23import invoice23import invoice
24import partner24import partner
25import generate_txt
26import report
25import res_company27import res_company
26import installer28import installer
2729
2830
=== modified file 'l10n_ve_withholding_iva/__openerp__.py'
--- l10n_ve_withholding_iva/__openerp__.py 2011-10-02 05:41:11 +0000
+++ l10n_ve_withholding_iva/__openerp__.py 2011-10-03 14:54:19 +0000
@@ -32,17 +32,25 @@
32 'init_xml': [],32 'init_xml': [],
33 "depends" : ["l10n_ve_withholding"],33 "depends" : ["l10n_ve_withholding"],
34 'update_xml': [34 'update_xml': [
35
35 'security/wh_iva_security.xml',36 'security/wh_iva_security.xml',
36 'security/ir.model.access.csv',37 'security/ir.model.access.csv',
37 'res_company_view.xml', 38 'generate_txt_view.xml',
39 'txt_wh_report.xml',
40 'res_company_view.xml',
38 'account_invoice_view.xml',41 'account_invoice_view.xml',
39 'account_view.xml',42 'account_view.xml',
40 'partner_view.xml', 43 'partner_view.xml',
41 'wh_iva_view.xml',44 'wh_iva_view.xml',
42 "data/l10n_ve_withholding_data.xml",45 "data/l10n_ve_withholding_data.xml",
43 "wh_iva_workflow.xml",46 "wh_iva_workflow.xml",
47<<<<<<< TREE
44 "account_workflow.xml", 48 "account_workflow.xml",
45 "l10n_ve_withholding_iva_installer.xml",49 "l10n_ve_withholding_iva_installer.xml",
50=======
51 "account_workflow.xml",
52
53>>>>>>> MERGE-SOURCE
46 ],54 ],
47 'demo_xml': ["demo/l10n_ve_withholding_iva_demo.xml"],55 'demo_xml': ["demo/l10n_ve_withholding_iva_demo.xml"],
48 'test': [],56 'test': [],
4957
=== added file 'l10n_ve_withholding_iva/generate_txt.py'
--- l10n_ve_withholding_iva/generate_txt.py 1970-01-01 00:00:00 +0000
+++ l10n_ve_withholding_iva/generate_txt.py 2011-10-03 14:54:19 +0000
@@ -0,0 +1,263 @@
1#!/usr/bin/python
2# -*- encoding: utf-8 -*-
3###########################################################################
4# Module Writen to OpenERP, Open Source Management Solution
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved
7###############Credits######################################################
8# Coded by: Humberto Arocha <humberto@openerp.com.ve>
9# Maria Gabriela Quilarque <gabriela@openerp.com.ve>
10# Javier Duran <javier@nvauxoo.com>
11# Planified by: Nhomar Hernandez
12# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
13# Audited by: Humberto Arocha humberto@openerp.com.ve
14#############################################################################
15# This program is free software: you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by
17# the Free Software Foundation, either version 3 of the License, or
18# (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27##############################################################################
28from osv import osv
29from osv import fields
30from tools.translate import _
31from tools import config
32import time
33import datetime
34from xml.etree.ElementTree import Element, SubElement, ElementTree, tostring
35import sys
36import base64
37
38class txt_iva(osv.osv):
39 _name = "txt.iva"
40
41 #~ def _get_amount_total(self,cr,uid,ids,name,args,context=None):
42 #~ res = {}
43 #~ for txt in self.browse(cr,uid,ids,context):
44 #~ res[txt.id]=0.0
45 #~ for txt_line in txt.txt_ids:
46 #~ res[txt.id] += txt_line.amount_withheld
47 #~
48 #~ return res
49
50 #~ def _get_amount_total_base(self,cr,uid,ids,name,args,context=None):
51 #~ res = {}
52 #~ for txt in self.browse(cr,uid,ids,context):
53 #~ res[txt.id]= 0.0
54 #~ for txt_line in txt.txt_ids:
55 #~ print 'result: ',res[txt.id]
56 #~ print 'monto: ', txt_line.untaxed
57 #~ res[txt.id] += txt_line.untaxed
58 #~
59 #~ return res
60
61 _columns = {
62 'company_id': fields.many2one('res.company', 'Compañía', required=True, readonly=True,states={'draft':[('readonly',False)]}),
63 'state': fields.selection([
64 ('draft','Draft'),
65 ('confirmed', 'Confirmed'),
66 ('done','Done'),
67 ('cancel','Cancelled')
68 ],'Estado', select=True, readonly=True, help="Estado del Comprobante"),
69 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Año Fiscal', required=True,readonly=True,states={'draft':[('readonly',False)]}),
70 'period_id':fields.many2one('account.period','Periodo',required=True,readonly=True,states={'draft':[('readonly',False)]}, domain="[('fiscalyear_id','=',fiscalyear_id)]"),
71 'type':fields.boolean('Retención Proveedores?',required=True,states={'draft':[('readonly',False)]}, help="Seleccione el tipo de retencion a realizar"),
72 'date_start': fields.date('Fecha Inicio',required=True,states={'draft':[('readonly',False)]}, help="Fecha de Inicio del periodo"),
73 'date_end': fields.date('Fecha Fin', required=True,states={'draft':[('readonly',False)]}, help="Fecha de Fin del periodo"),
74 'type':fields.boolean('Retención Proveedores?',required=True,states={'draft':[('readonly',False)]}, help="Seleccione el tipo de retencion a realizar"),
75 'txt_ids':fields.one2many('txt.iva.line','txt_id',domain="[('txt_id','=',False)]", readonly=True,states={'draft':[('readonly',False)]}, help='Lineas del archivo txt exigido por el SENIAT, para retención del IVA'),
76 #~ 'amount_total_ret':fields.function(_get_amount_total,method=True, digits=(16, 2), readonly=True, string=' Total Monto de Retencion', help="Monto Total Retenido"),
77 #~ '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"),
78 }
79 _rec_rame = 'company_id'
80 _defaults = {
81 'state': lambda *a: 'draft',
82 'company_id': lambda self, cr, uid, context: \
83 self.pool.get('res.users').browse(cr, uid, uid,
84 context=context).company_id.id,
85 'type': lambda *a:'True',
86 }
87
88 def action_anular(self, cr, uid, ids, context={}):
89 return self.write(cr, uid, ids, {'state':'draft'})
90
91 def action_confirm(self, cr, uid, ids, context={}):
92 return self.write(cr, uid, ids, {'state':'confirmed'})
93
94 def action_generate_lines_txt(self,cr,uid,ids,context={}):
95 voucher_obj = self.pool.get('account.wh.iva')
96 txt_iva_obj = self.pool.get('txt.iva.line')
97
98 voucher_ids=''
99 txt_brw= self.browse(cr,uid,ids[0])
100 txt_ids = txt_iva_obj.search(cr,uid,[('txt_id','=',txt_brw.id)])
101 if txt_ids:
102 txt_iva_obj.unlink(cr,uid,txt_ids)
103
104 if txt_brw.type:
105 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',['in_invoice','in_refund'])])
106 else:
107 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'])])
108
109 for voucher in voucher_obj.browse(cr,uid,voucher_ids):
110
111 for voucher_lines in voucher.retention_line:
112
113 if voucher_lines.invoice_id.state in ['open','paid']:
114 txt_iva_obj.create(cr,uid,
115 {'partner_id':voucher.partner_id.id,
116 'voucher_id':voucher.id,
117 'invoice_id':voucher_lines.invoice_id.id,
118 'txt_id': txt_brw.id,
119 'untaxed': voucher_lines.base_ret,
120 'amount_withheld': voucher_lines.amount_tax_ret,
121 })
122 return True
123
124 def action_done(self, cr, uid, ids, context={}):
125 root = self.generate_txt(cr,uid,ids)
126 self._write_attachment(cr,uid,ids,root,context)
127 self.write(cr, uid, ids, {'state':'done'})
128 return True
129
130 def get_type_document(self,cr,uid,txt_line):
131 type= '03'
132 if txt_line.invoice_id.type in ['out_invoice','in_invoice']:
133 type= '01'
134 elif txt_line.invoice_id.type in ['out_invoice','in_invoice'] and txt_line.invoice_id.parent_id:
135 type= '02'
136 return type
137
138 def get_document_affected(self,cr,uid,txt_line,context):
139 number='0'
140 if txt_line.invoice_id.type in ['in_invoice','in_refund'] and txt_line.invoice_id.parent_id:
141 number = txt_line.invoice_id.parent_id.reference
142 elif txt_line.invoice_id.parent_id:
143 number = txt_line.invoice_id.parent_id.number
144 return number
145
146 def get_number(self,cr,uid,number,inv_type,long):
147 if not number:
148 return '0'
149 result= ''
150 for i in number:
151 if inv_type=='vou_number' and i.isdigit():
152 if len(result)<long:
153 result = i + result
154 elif i.isalnum():
155 if len(result)<long:
156 result = i + result
157 return result[::-1].strip()
158
159 def get_document_number(self,cr,uid,ids,txt_line,inv_type,context):
160 number=0
161 if txt_line.invoice_id.type in ['in_invoice','in_refund']:
162 if not txt_line.invoice_id.reference:
163 raise osv.except_osv(_('Invalid action !'),_("Imposible realizar archivo txt, debido a que la factura no tiene numero de referencia libre!"))
164 else:
165 number = self.get_number(cr,uid,txt_line.invoice_id.reference.strip(),inv_type,20)
166 elif txt_line.invoice_id.number:
167 number = self.get_number(cr,uid,txt_line.invoice_id.number.strip(),inv_type,20)
168 return number
169
170 def get_amount_exempt_document(self,cr,uid,txt_line):
171 tax = 0
172 amount_doc = 0
173 for tax_line in txt_line.invoice_id.tax_line:
174 if 'SDCF' in tax_line.name:
175 tax = tax_line.base + tax
176 else:
177 amount_doc = tax_line.base + amount_doc
178 return (tax,amount_doc)
179
180 def get_buyer_vendor(self,cr,uid,txt,txt_line):
181 if txt_line.invoice_id.type in ['out_invoice','out_refund']:
182 vendor = txt.company_id.partner_id.vat[2:]
183 buyer = txt_line.partner_id.vat[2:]
184 else:
185 buyer = txt.company_id.partner_id.vat[2:]
186 vendor = txt_line.partner_id.vat[2:]
187 return (vendor,buyer)
188
189 def get_alicuota(self,cr,uid,txt_line):
190 list = []
191 for tax_line in txt_line.invoice_id.tax_line:
192 if '12' in tax_line.name:
193 list.append(12)
194 if '8' in tax_line.name:
195 list.append(8)
196 if '22' in tax_line.name:
197 list.append(22)
198 if '0' in tax_line.name:
199 list.append(0)
200 return max(list)
201
202 def generate_txt(self,cr,uid,ids,context=None):
203 txt_string = ''
204 for txt in self.browse(cr,uid,ids,context):
205 vat = txt.company_id.partner_id.vat[2:]
206 for txt_line in txt.txt_ids:
207
208 vendor,buyer=self.get_buyer_vendor(cr,uid,txt,txt_line)
209 period = txt.period_id.name.split('/')
210 period2 = period[1]+period[0]
211
212 operation_type = 'V' if txt_line.invoice_id.type in ['out_invoice','out_refund'] else 'C'
213 document_type = self.get_type_document(cr,uid,txt_line)
214 document_number=self.get_document_number(cr,uid,ids,txt_line,'inv_number',context)
215 control_number = self.get_number(cr,uid,txt_line.invoice_id.nro_ctrl,'inv_ctrl',20)
216 document_affected= self.get_document_affected(cr,uid,txt_line,context)
217 voucher_number = self.get_number(cr,uid,txt_line.voucher_id.number,'vou_number',14)
218 amount_exempt,amount_untaxed = self.get_amount_exempt_document(cr,uid,txt_line)
219 alicuota = self.get_alicuota(cr,uid,txt_line)
220
221 txt_string= txt_string + buyer +'\t'+period2.strip()+'\n'
222 #~ +'\t'\
223 #~ +txt_line.invoice_id.date_invoice+'\t'+operation_type+'\t'+document_type+'\t'+vendor+'\t'\
224 #~ +document_number+'\t'+control_number+'\t'+str(round(txt_line.invoice_id.amount_total,2))+'\t'\
225 #~ +str(round(amount_untaxed,2))+'\t'\
226 #~ +str(round(txt_line.amount_withheld,2))+'\t'+document_affected+'\t'+voucher_number+'\t'\
227 #~ +str(round(amount_exempt,2))+'\t'+str(alicuota)+'\t'+'0'\
228
229 return txt_string
230
231 def _write_attachment(self, cr,uid,ids,root,context):
232 '''
233 Codificar el txt, para guardarlo en la bd y poder verlo en el cliente como attachment
234 '''
235 fecha = time.strftime('%Y_%m_%d')
236 name = 'IVA_' + fecha +'.'+ 'txt'
237 self.pool.get('ir.attachment').create(cr, uid, {
238 'name': name,
239 'datas': base64.encodestring(root),
240 'datas_fname': name,
241 'res_model': 'txt.iva',
242 'res_id': ids[0],
243 }, context=context
244 )
245 cr.commit()
246
247txt_iva()
248
249
250class txt_iva_line(osv.osv):
251 _name = "txt.iva.line"
252
253 _columns = {
254 '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)"),
255 '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"),
256 'voucher_id':fields.many2one('account.wh.iva','Comprobante de Retencion IVA',help="Comprobante de Retencion de Impuesto al Valor Agregado (IVA)"),
257 'amount_withheld':fields.float('Amount Withheld'),
258 'untaxed':fields.float('Untaxed'),
259 'txt_id':fields.many2one('txt.iva','Documento-Generar txt IVA'),
260 }
261 _rec_name = 'partner_id'
262
263txt_iva_line()
0264
=== added file 'l10n_ve_withholding_iva/generate_txt_view.xml'
--- l10n_ve_withholding_iva/generate_txt_view.xml 1970-01-01 00:00:00 +0000
+++ l10n_ve_withholding_iva/generate_txt_view.xml 2011-10-03 14:54:19 +0000
@@ -0,0 +1,108 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <!--
6 =====================================================
7 XML GENERATE
8 =====================================================
9 -->
10
11 <record id="view_generate_txt_iva_tree" model="ir.ui.view">
12 <field name="name">generate.txt.iva.tree</field>
13 <field name="model">txt.iva</field>
14 <field name="type">tree</field>
15 <field name="arch" type="xml">
16 <tree string="Archivo TXT">
17 <field name="company_id"/>
18 <field name="fiscalyear_id"/>
19 <field name="period_id"/>
20 <field name="type"/>
21 </tree>
22 </field>
23 </record>
24
25 <record id="view_generate_txt_iva_form" model="ir.ui.view">
26 <field name="name">generate.txt.iva.form</field>
27 <field name="model">txt.iva</field>
28 <field name="type">form</field>
29 <field name="arch" type="xml">
30 <form string="Lineas de Retencion para TXT">
31 <group col="4" colspan="4">
32 <field name="company_id"/>
33 <field name="type"/>
34 </group>
35 <newline/>
36 <group col="4" colspan="4">
37 <field name="fiscalyear_id" />
38 <field name="period_id" />
39 </group>
40 <newline/>
41 <group col="4" colspan="4">
42 <field name="date_start"/>
43 <field name="date_end"/>
44 </group>
45 <notebook colspan="4">
46 <page string="Lineas de Retencion">
47 <field name="txt_ids" nolabel="1" colspan='4' widget="one2many_list">
48 <tree string="Lineas del archivo TXT">
49 <field name="partner_id"/>
50 <field name="invoice_id"/>
51 <field name="voucher_id"/>
52 <field name="untaxed"/>
53 <field name="amount_withheld"/>
54 </tree>
55 </field>
56 <group col="4" colspan="2">
57 <field name="state" select="2" colspan="4"/>
58 <button name="action_generate_lines_txt" string="Generar Lineas TXT" states="draft" type="object" icon="gtk-go-forward" colspan="4"/>
59 <button name="action_confirm" string="Confirmar" states="draft" type="object" icon="gtk-go-forward" colspan="4"/>
60 <button name="action_done" string="Realizar TXT" states="confirmed" type="object" icon="gtk-ok"/>
61 <button name="action_anular" string="Anular" states="confirmed,done" type="object" icon="gtk-cancel"/>
62 </group>
63<!--
64 <group col="2" colspan="2">
65 <field name="amount_total_ret"/>
66 <field name="amount_total_base"/>
67 </group>
68-->
69 </page>
70 </notebook>
71 </form>
72 </field>
73 </record>
74
75 <record model="ir.actions.act_window" id="action_generate_text_iva">
76 <field name="name">Generate TXT</field>
77 <field name="res_model">txt.iva</field>
78 <field name="type">ir.actions.act_window</field>
79 <field name="view_type">form</field>
80 <field name="view_mode">tree,form</field>
81 </record>
82
83 <record model="ir.actions.act_window.view" id="action_generate_txt_iva_tree">
84 <field name="sequence" eval="10"/>
85 <field name="view_mode">tree</field>
86 <field name="view_id" ref="view_generate_txt_iva_tree"/>
87 <field name="act_window_id" ref="action_generate_text_iva"/>
88 </record>
89
90 <record model="ir.actions.act_window.view" id="action_generate_txt_iva_form">
91 <field name="sequence" eval="20"/>
92 <field name="view_mode">form</field>
93 <field name="view_id" ref="view_generate_txt_iva_form"/>
94 <field name="act_window_id" ref="action_generate_text_iva"/>
95 </record>
96
97 <menuitem name="Generar TXT"
98 id="menu_action_generate_txt_iva"
99 parent="l10n_ve_withholding.menu_wh_suppiler"
100 action="action_generate_text_iva"/>
101
102 </data>
103</openerp>
104
105
106
107
108
0109
=== modified file 'l10n_ve_withholding_iva/partner.py'
--- l10n_ve_withholding_iva/partner.py 2011-09-28 03:57:04 +0000
+++ l10n_ve_withholding_iva/partner.py 2011-10-03 14:54:19 +0000
@@ -55,6 +55,7 @@
55 }55 }
5656
57 def _load_url(self,retries,url):57 def _load_url(self,retries,url):
58 print 'load'
58 str_error= '404 Not Found'59 str_error= '404 Not Found'
59 while retries > 0:60 while retries > 0:
60 try:61 try:
@@ -69,12 +70,11 @@
69 return str_error70 return str_error
7071
71 def _buscar_porcentaje(self,rif,url):72 def _buscar_porcentaje(self,rif,url):
72 '''
73 Search percent of withholding connecting to SENIAT
74 '''
75 context={}73 context={}
74 print"esta pasando por aqui"
76 html_data = self._load_url(3,url %rif)75 html_data = self._load_url(3,url %rif)
77 html_data = unicode(html_data, 'ISO-8859-1').encode('utf-8')76 html_data = unicode(html_data, 'ISO-8859-1').encode('utf-8')
77 print "html_data",html_data
78 self._eval_seniat_data(html_data,context)78 self._eval_seniat_data(html_data,context)
79 search_str='La condición de este contribuyente requiere la retención del '79 search_str='La condición de este contribuyente requiere la retención del '
80 pos = html_data.find(search_str)80 pos = html_data.find(search_str)
@@ -86,13 +86,13 @@
86 return 0.086 return 0.0
8787
88 def _parse_dom(self,dom,rif,url_seniat):88 def _parse_dom(self,dom,rif,url_seniat):
89 '''89 print 'entrando dom'
90 Parsing data from SENIAT
91 '''
92 name = dom.childNodes[0].childNodes[0].firstChild.data 90 name = dom.childNodes[0].childNodes[0].firstChild.data
93 wh_agent = dom.childNodes[0].childNodes[1].firstChild.data.upper()=='SI' and True or False91 wh_agent = dom.childNodes[0].childNodes[1].firstChild.data.upper()=='SI' and True or False
94 vat_apply = dom.childNodes[0].childNodes[2].firstChild.data.upper()=='SI' and True or False92 vat_apply = dom.childNodes[0].childNodes[2].firstChild.data.upper()=='SI' and True or False
95 wh_rate = self._buscar_porcentaje(rif,url_seniat)93 wh_rate = self._buscar_porcentaje(rif,url_seniat)
94 print "wh_rate",wh_rate
95 print 'nombre: ',name
96 return {'name':name, 'wh_iva_agent':wh_agent,'vat_subjected':vat_apply,'wh_iva_rate':wh_rate}96 return {'name':name, 'wh_iva_agent':wh_agent,'vat_subjected':vat_apply,'wh_iva_rate':wh_rate}
9797
98 def _print_error(self, error, msg):98 def _print_error(self, error, msg):
@@ -113,11 +113,13 @@
113 self._print_error(_('No Connection !'),_("Could not connect! Check the URL "))113 self._print_error(_('No Connection !'),_("Could not connect! Check the URL "))
114 114
115 def update_rif(self, cr, uid, ids, context={}):115 def update_rif(self, cr, uid, ids, context={}):
116 print 'entando update'
116 for partner in self.browse(cr,uid,ids):117 for partner in self.browse(cr,uid,ids):
117 url1=partner.company_id.url_seniat1_company+'%s'118 url1=partner.company_id.url_seniat1_company+'%s'
118 url2=partner.company_id.url_seniat2_company+'%s'119 url2=partner.company_id.url_seniat2_company+'%s'
119 xml_data = self._load_url(3,url1 %partner.vat[2:])120 xml_data = self._load_url(3,url1 %partner.vat[2:])
120 self._eval_seniat_data(xml_data,context)121 self._eval_seniat_data(xml_data,context)
122 print 'xml_data',xml_data
121 dom = parseString(xml_data)123 dom = parseString(xml_data)
122 self.write(cr,uid,partner.id,self._parse_dom(dom,partner.vat[2:],url2))124 self.write(cr,uid,partner.id,self._parse_dom(dom,partner.vat[2:],url2))
123 return True125 return True
124126
=== added directory 'l10n_ve_withholding_iva/report'
=== added file 'l10n_ve_withholding_iva/report/__init__.py'
--- l10n_ve_withholding_iva/report/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_ve_withholding_iva/report/__init__.py 2011-10-03 14:54:19 +0000
@@ -0,0 +1,30 @@
1#!/usr/bin/python
2# -*- encoding: utf-8 -*-
3###########################################################################
4# Module Writen to OpenERP, Open Source Management Solution
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved
7###############Credits######################################################
8# Coded by: Humberto Arocha <humberto@openerp.com.ve>
9# Maria Gabriela Quilarque <gabriela@openerp.com.ve>
10# Javier Duran <javier@nvauxoo.com>
11# Planified by: Nhomar Hernandez
12# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
13# Audited by: Humberto Arocha humberto@openerp.com.ve
14#############################################################################
15# This program is free software: you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by
17# the Free Software Foundation, either version 3 of the License, or
18# (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27##############################################################################
28
29import list_wh_iva
30
031
=== added file 'l10n_ve_withholding_iva/report/list_wh_iva.py'
--- l10n_ve_withholding_iva/report/list_wh_iva.py 1970-01-01 00:00:00 +0000
+++ l10n_ve_withholding_iva/report/list_wh_iva.py 2011-10-03 14:54:19 +0000
@@ -0,0 +1,54 @@
1#!/usr/bin/python
2# -*- encoding: utf-8 -*-
3###########################################################################
4# Module Writen to OpenERP, Open Source Management Solution
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved
7###############Credits######################################################
8# Coded by: Humberto Arocha <humberto@openerp.com.ve>
9# Maria Gabriela Quilarque <gabriela@openerp.com.ve>
10# Javier Duran <javier@nvauxoo.com>
11# Planified by: Nhomar Hernandez
12# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
13# Audited by: Humberto Arocha humberto@openerp.com.ve
14#############################################################################
15# This program is free software: you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by
17# the Free Software Foundation, either version 3 of the License, or
18# (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27##############################################################################
28
29import time
30import pooler
31from report import report_sxw
32from tools.translate import _
33
34class list_wh_iva(report_sxw.rml_parse):
35 def __init__(self, cr, uid, name, context):
36 super(list_wh_iva, self).__init__(cr, uid, name, context=context)
37 self.localcontext.update({
38 'get_type_doc': self._get_type_document,
39 })
40
41 def _get_type_document(self,line):
42 return self.pool.get('txt.iva').get_type_document(self.cr,self.uid,line)
43
44 #~ def get_type_document(self,cr,uid,txt_line):
45
46
47
48report_sxw.report_sxw(
49 'report.list_report_wh_vat2',
50 'txt.iva',
51 'addons/l10n_ve_withholding_iva/report/list_wh_iva_report.rml',
52 parser=list_wh_iva,
53 header=False
54)
055
=== added file 'l10n_ve_withholding_iva/report/list_wh_iva_report.rml'
--- l10n_ve_withholding_iva/report/list_wh_iva_report.rml 1970-01-01 00:00:00 +0000
+++ l10n_ve_withholding_iva/report/list_wh_iva_report.rml 2011-10-03 14:54:19 +0000
@@ -0,0 +1,157 @@
1<?xml version="1.0"?>
2<document filename="test.pdf">
3 <template pageSize="(280.0mm,210.0mm)" title="Test" author="Martin Simon" allowSplitting="20" showBoundary="0">
4 <pageTemplate id="first">
5 <pageGraphics>
6 <image x="7.0mm" y="175.0mm" height="25mm" width="96mm">[[company.logo and company.logo or removeParentNode('image')]]</image>
7 <drawString x="7.0mm" y="175.0mm">[[company.logo and removeParentNode('para') or company.name]]</drawString>
8 <place x="7.0mm" y="100.0mm" width="280.0mm" height="100.0mm">
9 <!--TABLA DE TITULOS-->
10 <blockTable colWidths="96mm,170mm" style="TITLE">
11 <tr>
12 <td><para style="TITLE"></para>
13 </td>
14 <td>
15 <para style="TITLE"><b>DECLARACION INFORMATIVA DE RETENCIONES IVA</b></para>
16 </td>
17 </tr>
18 </blockTable>
19 <blockTable colWidths="96mm,170.0mm" style="TITLEGRISCLAROARRIBA">
20 <tr>
21 <td><para style="ITEMSCENTER"> </para>
22 </td>
23 <td>
24 <para style="ITEMSCENTER"><b>PERIODO FISCAL</b></para>
25 </td>
26 </tr>
27 </blockTable>
28 <blockTable colWidths="96mm,170.0mm" style="TITLEGRISWHITE">
29 <tr>
30 <td><para style="ITEMSCENTER"> </para>
31 </td>
32 <td>
33 <para style="ITEMSCENTER"><b>[[ o.period_id.name]]</b></para>
34 </td>
35 </tr>
36 </blockTable>
37 </place>
38 <setFont name="Helvetica-BoldOblique" size="8.0"/>
39 <drawRightString x="270mm" y="5mm">RETENCIONES DE IVA / PAGINA: <pageNumber/> DE <pageCount/> </drawRightString>
40
41 </pageGraphics>
42 <frame id="first" x1="20.0" y1="20.0" width="753" height="480"/>
43 </pageTemplate>
44 </template>
45
46 <stylesheet>
47 <blockTableStyle id="TITLE">
48 <lineStyle kind="GRID" colorName="black" start="1,0" stop="-1,-1" thickness="0.5"/>
49 <blockValign value="TOP"/>
50 </blockTableStyle>
51 <blockTableStyle id="TOTAL">
52 <blockValign value="TOP"/>
53 <lineStyle kind="GRID" colorName="black" start="1,0" stop="-1,-1" thickness="0.5" />
54 </blockTableStyle>
55 <blockTableStyle id="TITLEGRISCLAROARRIBA">
56 <blockBackground colorName="#e5e2e5" start="1,0" stop="-1,-1"/>
57 <lineStyle kind="GRID" colorName="black" start="1,0" stop="-1,-1" thickness="0.5"/>
58 <blockValign value="MIDDLE"/>
59 </blockTableStyle>
60 <blockTableStyle id="TITLEGRISWHITE">
61 <lineStyle kind="GRID" colorName="black" start="1,0" stop="-1,-1" thickness="0.5"/>
62 <blockValign value="MIDDLE"/>
63 </blockTableStyle>
64 <blockTableStyle id="Tabla3">
65 <blockBackground colorName="#e5e2e5" start="0,0" stop="-1,0"/>
66 <blockAlignment value="LEFT"/>
67 <blockValign value="TOP"/>
68 <lineStyle kind="GRID" colorName="black" start="0,0" stop="-1,-1" thickness="0.5"/>
69 <blockValign value="MIDDLE"/>
70 </blockTableStyle>
71 <blockTableStyle id="Tablatotalgeneral">
72 <blockAlignment value="LEFT"/>
73 <blockValign value="TOP"/>
74 <lineStyle kind="GRID" colorName="black" start="9,0" stop="-1,-1" thickness="0.5"/>
75 <blockValign value="MIDDLE"/>
76 </blockTableStyle>
77 <initialize>
78 <paraStyle name="all" alignment="justify"/>
79 </initialize>
80 <paraStyle name="TITLE" alignment="CENTER" fontName="Helvetica" fontSize="12.0" leading="20" spaceBefore="-3.0" textColor="black"/>
81 <paraStyle name="ITEMSCENTER" alignment="CENTER" fontName="Helvetica-Bold" fontSize="10.0" leading="9" spaceBefore="3.0" textColor="black"/>
82 <paraStyle name="ITEMSRIF" alignment="CENTER" fontName="Helvetica-Bold" fontSize="12.0" leading="11" spaceBefore="3.0" textColor="black"/>
83 <paraStyle name="P15" fontName="Helvetica-Bold" fontSize="10.0" leading="10" spaceBefore="3.0" alignment="CENTER"/>
84 <paraStyle name="P12" fontName="Helvetica" fontSize="10.0" leading="11" alignment="CENTER"/>
85 <paraStyle name="P13" fontName="Helvetica" fontSize="10.0" leading="11" alignment="RIGHT"/>
86 <paraStyle name="P16" fontName="Helvetica-Bold" fontSize="10.0" leading="11" alignment="RIGHT"/>
87 <paraStyle name="P14" fontName="Helvetica" fontSize="10.0" leading="11" alignment="LEFT"/>
88 <paraStyle name="P22" fontName="Helvetica" fontSize="9.0" leading="11" spaceBefore="0.0" spaceAfter="6.0" alignment="RIGHT"/>
89 </stylesheet>
90 <images/>
91
92 <story>
93 <para>[[repeatIn(objects,'o')]]</para>
94 <para>[[ setLang(company.partner_id.lang) ]]</para>
95 <blockTable colWidths="410.0,198.0,50.0,50.0,45.0" repeatRows='1' style="Tabla3">
96<!--
97 <blockTable colWidths="75.0,335.0,68.0,50.0,80.0,60.0,85.0" repeatRows='1' style="Tabla3">
98-->
99 <tr>
100 <td><para style="P15">RIF Contribuyente</para></td>
101 <td><para style="P15">Periodo</para></td>
102 <td><para style="P15">Fecha Doc.</para></td>
103 <td><para style="P15">Tipo Ope.</para></td>
104 <td><para style="P15">Tipo Doc.</para></td>
105<!--
106 <td><para style="P15">RIF C/V</para></td>
107 <td><para style="P15">Num Doc.</para></td>
108 <td><para style="P15">Num Control</para></td>
109 <td><para style="P15">Monto Doc.</para></td>
110 <td><para style="P15">Base Impo.</para></td>
111 <td><para style="P15">Monto IVA</para></td>
112 <td><para style="P15">Num.Doc.Afec.</para></td>
113 <td><para style="P15">Num.Compro.</para></td>
114 <td><para style="P15">Monto Exc. IVA</para></td>
115 <td><para style="P15">Alicuota</para></td>
116 <td><para style="P15">Expediente</para></td>
117-->
118 </tr>
119 <tr>[[repeatIn(o.txt_ids,'line')]]
120 <td><para style="P12">[[ '98798' ]]</para></td>
121 <td><para style="P14">[[ o.period_id.name ]]</para></td>
122 <td><para style="P12">[[ line.invoice_id.date_invoice ]]</para></td>
123 <td><para style="P12">[[ (line.invoice_id.type in ['out_invoice','out_refund']) and 'V' or 'C' ]]</para></td>
124 <td><para style="P13">[[ get_type_doc(line) ]]</para></td>
125
126<!--
127 <td><para style="P13">[[ ]]</para></td>
128 <td><para style="P13">[[ ]]</para></td>
129 <td><para style="P13">[[ ]]</para></td>
130 <td><para style="P13">[[ ]]</para></td>
131 <td><para style="P13">[[ ]]</para></td>
132 <td><para style="P13">[[ ]]</para></td>
133 <td><para style="P13">[[ ]]</para></td>
134 <td><para style="P13">[[ ]]</para></td>
135 <td><para style="P13">[[ ]]</para></td>
136 <td><para style="P13">[[ ]]</para></td>
137 <td><para style="P13">[[ ]]</para></td>
138-->
139 </tr>
140 </blockTable>
141 <blockTable colWidths="410.0,198.0,145.0" style="TOTAL">
142 <tr>
143 <td><para style="P22"><font color="white"></font></para></td>
144 <td><para style="P16">TOTAL BASE IMPONIBLE</para></td>
145 <td><para style="P16">[[ formatLang(o.amount_total_base) ]]</para></td>
146 </tr>
147 <tr>
148 <td><para style="P22"><font color="white"></font></para></td>
149 <td><para style="P16">TOTAL MONTO DE RETENCION</para></td>
150 <td><para style="P16">[[ formatLang(o.amount_total_ret) ]]</para></td>
151 </tr>
152 </blockTable>
153
154 </story>
155
156</document>
157
0158
=== added file 'l10n_ve_withholding_iva/txt_wh_report.xml'
--- l10n_ve_withholding_iva/txt_wh_report.xml 1970-01-01 00:00:00 +0000
+++ l10n_ve_withholding_iva/txt_wh_report.xml 2011-10-03 14:54:19 +0000
@@ -0,0 +1,15 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <report
5 id="list_report_wh_vat"
6 menu="True"
7 model="txt.iva"
8 name="list_report_wh_vat2"
9 rml="l10n_ve_withholding_iva/report/list_wh_iva_report.rml"
10 string="Retenciones IVA"
11 auto = "True"
12 header="False"/>
13 </data>
14</openerp>
15