Merge lp:~juan-pimentel/openerp-venezuela-localization/juan-pimentel_openerp-venezuela-localization_bluprint_reporte-generar-txt into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
- juan-pimentel_openerp-venezuela-localization_bluprint_reporte-generar-txt
- Merge into 6.0-trunk
Proposed by
Juan José Pimentel (Digisolution)
Status: | Merged |
---|---|
Merged at revision: | 594 |
Proposed branch: | lp:~juan-pimentel/openerp-venezuela-localization/juan-pimentel_openerp-venezuela-localization_bluprint_reporte-generar-txt |
Merge into: | lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk |
Diff against target: |
342 lines (+147/-71) 3 files modified
l10n_ve_withholding_iva/model/generate_txt.py (+6/-6) l10n_ve_withholding_iva/report/list_wh_iva.py (+46/-3) l10n_ve_withholding_iva/report/list_wh_iva_report.rml (+95/-62) |
To merge this branch: | bzr merge lp:~juan-pimentel/openerp-venezuela-localization/juan-pimentel_openerp-venezuela-localization_bluprint_reporte-generar-txt |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gabriela Quilarque | bluprint | Pending | |
Review via email: mp+90614@code.launchpad.net |
Commit message
Description of the change
Se realizo un refactoring al modelo txt.iva de tal manera que el "context" sea opcoinal y no obligatorio.
Se modifico el reporte existente y se creo uno que mostrara toda la información requerida en el txt pero de una manera organizada y mas legible.
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
1 | === modified file 'l10n_ve_withholding_iva/model/generate_txt.py' |
2 | --- l10n_ve_withholding_iva/model/generate_txt.py 2012-01-19 14:04:28 +0000 |
3 | +++ l10n_ve_withholding_iva/model/generate_txt.py 2012-01-29 17:09:23 +0000 |
4 | @@ -147,7 +147,7 @@ |
5 | type= '02' |
6 | return type |
7 | |
8 | - def get_document_affected(self,cr,uid,txt_line,context): |
9 | + def get_document_affected(self,cr,uid,txt_line,context={}): |
10 | number='0' |
11 | if txt_line.invoice_id.type in ['in_invoice','in_refund'] and txt_line.invoice_id.parent_id: |
12 | number = txt_line.invoice_id.parent_id.reference |
13 | @@ -168,7 +168,7 @@ |
14 | result = i + result |
15 | return result[::-1].strip() |
16 | |
17 | - def get_document_number(self,cr,uid,ids,txt_line,inv_type,context): |
18 | + def get_document_number(self,cr,uid,ids,txt_line,inv_type,context={}): |
19 | number=0 |
20 | if txt_line.invoice_id.type in ['in_invoice','in_refund']: |
21 | if not txt_line.invoice_id.reference: |
22 | @@ -211,7 +211,7 @@ |
23 | list.append(0) |
24 | return max(list) |
25 | |
26 | - def generate_txt(self,cr,uid,ids,context=None): |
27 | + def generate_txt(self,cr,uid,ids,context={}): |
28 | txt_string = '' |
29 | for txt in self.browse(cr,uid,ids,context): |
30 | vat = txt.company_id.partner_id.vat[2:] |
31 | @@ -223,9 +223,9 @@ |
32 | |
33 | operation_type = 'V' if txt_line.invoice_id.type in ['out_invoice','out_refund'] else 'C' |
34 | document_type = self.get_type_document(cr,uid,txt_line) |
35 | - document_number=self.get_document_number(cr,uid,ids,txt_line,'inv_number',context) |
36 | + document_number=self.get_document_number(cr,uid,ids,txt_line,'inv_number') |
37 | control_number = self.get_number(cr,uid,txt_line.invoice_id.nro_ctrl,'inv_ctrl',20) |
38 | - document_affected= self.get_document_affected(cr,uid,txt_line,context) |
39 | + document_affected= self.get_document_affected(cr,uid,txt_line) |
40 | voucher_number = self.get_number(cr,uid,txt_line.voucher_id.number,'vou_number',14) |
41 | amount_exempt,amount_untaxed = self.get_amount_exempt_document(cr,uid,txt_line) |
42 | alicuota = self.get_alicuota(cr,uid,txt_line) |
43 | @@ -239,7 +239,7 @@ |
44 | +'\n' |
45 | return txt_string |
46 | |
47 | - def _write_attachment(self, cr,uid,ids,root,context): |
48 | + def _write_attachment(self, cr,uid,ids,root,context={}): |
49 | ''' |
50 | Encrypt txt, save it to the db and view it on the client as an attachment |
51 | ''' |
52 | |
53 | === modified file 'l10n_ve_withholding_iva/report/list_wh_iva.py' |
54 | --- l10n_ve_withholding_iva/report/list_wh_iva.py 2011-10-25 20:33:16 +0000 |
55 | +++ l10n_ve_withholding_iva/report/list_wh_iva.py 2012-01-29 17:09:23 +0000 |
56 | @@ -32,18 +32,61 @@ |
57 | from tools.translate import _ |
58 | |
59 | class list_wh_iva(report_sxw.rml_parse): |
60 | + |
61 | + total_amount_exempt=0 |
62 | + total_amount_untaxed=0 |
63 | + |
64 | def __init__(self, cr, uid, name, context): |
65 | super(list_wh_iva, self).__init__(cr, uid, name, context=context) |
66 | self.localcontext.update({ |
67 | 'get_type_doc': self._get_type_document, |
68 | + 'get_doc_number':self._get_document_number, |
69 | + 'get_doc_affected':self._get_document_affected, |
70 | + 'get_ctrl_number':self._get_control_number, |
71 | + 'get_alicuota':self._get_alicuota, |
72 | + 'get_amount_exempt':self._get_amount_exempt, |
73 | + 'get_total_amount_exempt':self._get_total_amount_exempt, |
74 | + 'get_amount_untaxed':self._get_amount_untaxed, |
75 | + 'get_total_amount_untaxed':self._get_total_amount_untaxed, |
76 | + 'get_total_amount_doc':self._get_total_amount_doc, |
77 | }) |
78 | + |
79 | + def _get_total_amount_doc(self,doc_id): |
80 | + total=0 |
81 | + for line in self.pool.get('txt.iva').browse(self.cr,self.uid, doc_id).txt_ids: |
82 | + total+=line.invoice_id.amount_total |
83 | + return total |
84 | + |
85 | + def _get_alicuota(self,txt_line): |
86 | + return self.pool.get('txt.iva').get_alicuota(self.cr,self.uid,txt_line) |
87 | + |
88 | + def _get_amount_exempt(self,txt_line): |
89 | + amount_exempt,amount_untaxed = self.pool.get('txt.iva').get_amount_exempt_document(self.cr,self.uid,txt_line) |
90 | + self.total_amount_exempt+=amount_exempt |
91 | + return amount_exempt |
92 | + |
93 | + def _get_total_amount_exempt(self): |
94 | + return self.total_amount_exempt |
95 | + |
96 | + def _get_amount_untaxed(self,txt_line): |
97 | + amount_exempt,amount_untaxed = self.pool.get('txt.iva').get_amount_exempt_document(self.cr,self.uid,txt_line) |
98 | + self.total_amount_untaxed+=amount_untaxed |
99 | + return amount_untaxed |
100 | + |
101 | + def _get_total_amount_untaxed(self): |
102 | + return self.total_amount_untaxed |
103 | + |
104 | + def _get_control_number(self,txt_line): |
105 | + return self.pool.get('txt.iva').get_number(self.cr,self.uid,txt_line.invoice_id.nro_ctrl,'inv_ctrl',20) |
106 | |
107 | def _get_type_document(self,line): |
108 | return self.pool.get('txt.iva').get_type_document(self.cr,self.uid,line) |
109 | |
110 | - #~ def get_type_document(self,cr,uid,txt_line): |
111 | - |
112 | - |
113 | + def _get_document_number(self,txt_id,txt_line): |
114 | + return self.pool.get('txt.iva').get_document_number(self.cr,self.uid,txt_id,txt_line,'inv_number') |
115 | + |
116 | + def _get_document_affected(self,line): |
117 | + return self.pool.get('txt.iva').get_document_affected(self.cr,self.uid,line) |
118 | |
119 | report_sxw.report_sxw( |
120 | 'report.list_report_wh_vat2', |
121 | |
122 | === modified file 'l10n_ve_withholding_iva/report/list_wh_iva_report.rml' |
123 | --- l10n_ve_withholding_iva/report/list_wh_iva_report.rml 2011-10-25 20:33:16 +0000 |
124 | +++ l10n_ve_withholding_iva/report/list_wh_iva_report.rml 2012-01-29 17:09:23 +0000 |
125 | @@ -18,10 +18,18 @@ |
126 | </blockTable> |
127 | <blockTable colWidths="96mm,170.0mm" style="TITLEGRISCLAROARRIBA"> |
128 | <tr> |
129 | - <td><para style="ITEMSCENTER"> </para> |
130 | - </td> |
131 | + <td><para style="ITEMSCENTER"></para></td> |
132 | <td> |
133 | - <para style="ITEMSCENTER"><b>PERIODO FISCAL</b></para> |
134 | + <blockTable colWidths="85mm,85mm" style="SUBTITLEGRISCLAROARRIBA"> |
135 | + <tr> |
136 | + <td> |
137 | + <para style="ITEMSCENTER"><b>PERIODO FISCAL</b></para> |
138 | + </td> |
139 | + <td> |
140 | + <para style="ITEMSCENTER"><b>[[ o.company_id and o.company_id.name or '' ]] </b></para> |
141 | + </td> |
142 | + </tr> |
143 | + </blockTable> |
144 | </td> |
145 | </tr> |
146 | </blockTable> |
147 | @@ -30,12 +38,23 @@ |
148 | <td><para style="ITEMSCENTER"> </para> |
149 | </td> |
150 | <td> |
151 | - <para style="ITEMSCENTER"><b>[[ o.period_id.name]]</b></para> |
152 | + <blockTable colWidths="85mm,85mm" style="SUBTITLEGRISWHITE"> |
153 | + <tr> |
154 | + <td> |
155 | + <para style="ITEMSCENTER"><b>[[ o.period_id and o.period_id.name or '']]</b></para> |
156 | + </td> |
157 | + <td> |
158 | + |
159 | + <para style="ITEMSCENTER"><b>[[ o.company_id and ('%s-%s-%s'%(o.company_id.partner_id.vat[2:3],o.company_id.partner_id.vat[3:11],o.company_id.partner_id.vat[11:12])) or '' ]] </b></para> |
160 | + </td> |
161 | + </tr> |
162 | + </blockTable> |
163 | + |
164 | </td> |
165 | </tr> |
166 | </blockTable> |
167 | </place> |
168 | - <setFont name="Helvetica-BoldOblique" size="8.0"/> |
169 | + <setFont name="Times-Bold" size="8.0"/> |
170 | <drawRightString x="270mm" y="5mm">RETENCIONES DE IVA / PAGINA: <pageNumber/> DE <pageCount/> </drawRightString> |
171 | |
172 | </pageGraphics> |
173 | @@ -53,14 +72,22 @@ |
174 | <lineStyle kind="GRID" colorName="black" start="1,0" stop="-1,-1" thickness="0.5" /> |
175 | </blockTableStyle> |
176 | <blockTableStyle id="TITLEGRISCLAROARRIBA"> |
177 | + <blockAlignment value="CENTER"/> |
178 | <blockBackground colorName="#e5e2e5" start="1,0" stop="-1,-1"/> |
179 | <lineStyle kind="GRID" colorName="black" start="1,0" stop="-1,-1" thickness="0.5"/> |
180 | <blockValign value="MIDDLE"/> |
181 | </blockTableStyle> |
182 | + <blockTableStyle id="SUBTITLEGRISCLAROARRIBA"> |
183 | + <blockAlignment value="CENTER"/> |
184 | + <blockValign value="MIDDLE"/> |
185 | + </blockTableStyle> |
186 | <blockTableStyle id="TITLEGRISWHITE"> |
187 | <lineStyle kind="GRID" colorName="black" start="1,0" stop="-1,-1" thickness="0.5"/> |
188 | <blockValign value="MIDDLE"/> |
189 | </blockTableStyle> |
190 | + <blockTableStyle id="SUBTITLEGRISWHITE"> |
191 | + <blockValign value="MIDDLE"/> |
192 | + </blockTableStyle> |
193 | <blockTableStyle id="Tabla3"> |
194 | <blockBackground colorName="#e5e2e5" start="0,0" stop="-1,0"/> |
195 | <blockAlignment value="LEFT"/> |
196 | @@ -74,83 +101,89 @@ |
197 | <lineStyle kind="GRID" colorName="black" start="9,0" stop="-1,-1" thickness="0.5"/> |
198 | <blockValign value="MIDDLE"/> |
199 | </blockTableStyle> |
200 | + <blockTableStyle id="LEGEND"> |
201 | + <blockAlignment value="LEFT"/> |
202 | + <blockValign value="MIDDLE"/> |
203 | + </blockTableStyle> |
204 | <initialize> |
205 | <paraStyle name="all" alignment="justify"/> |
206 | </initialize> |
207 | - <paraStyle name="TITLE" alignment="CENTER" fontName="Helvetica" fontSize="12.0" leading="20" spaceBefore="-3.0" textColor="black"/> |
208 | - <paraStyle name="ITEMSCENTER" alignment="CENTER" fontName="Helvetica-Bold" fontSize="10.0" leading="9" spaceBefore="3.0" textColor="black"/> |
209 | - <paraStyle name="ITEMSRIF" alignment="CENTER" fontName="Helvetica-Bold" fontSize="12.0" leading="11" spaceBefore="3.0" textColor="black"/> |
210 | - <paraStyle name="P15" fontName="Helvetica-Bold" fontSize="10.0" leading="10" spaceBefore="3.0" alignment="CENTER"/> |
211 | - <paraStyle name="P12" fontName="Helvetica" fontSize="10.0" leading="11" alignment="CENTER"/> |
212 | - <paraStyle name="P13" fontName="Helvetica" fontSize="10.0" leading="11" alignment="RIGHT"/> |
213 | - <paraStyle name="P16" fontName="Helvetica-Bold" fontSize="10.0" leading="11" alignment="RIGHT"/> |
214 | - <paraStyle name="P14" fontName="Helvetica" fontSize="10.0" leading="11" alignment="LEFT"/> |
215 | - <paraStyle name="P22" fontName="Helvetica" fontSize="9.0" leading="11" spaceBefore="0.0" spaceAfter="6.0" alignment="RIGHT"/> |
216 | + <paraStyle name="TITLE" alignment="CENTER" fontName="Times-Roman" fontSize="12.0" leading="20" spaceBefore="-3.0" textColor="black"/> |
217 | + <paraStyle name="ITEMSCENTER" alignment="CENTER" fontName="Times-Bold" fontSize="10.0" leading="9" spaceBefore="3.0" textColor="black"/> |
218 | + <paraStyle name="ITEMSRIF" alignment="CENTER" fontName="Times-Roman-Bold" fontSize="12.0" leading="11" spaceBefore="3.0" textColor="black"/> |
219 | + <paraStyle name="P15" fontName="Times-Bold" fontSize="10.0" leading="10" spaceBefore="3.0" alignment="CENTER"/> |
220 | + <paraStyle name="P12" fontName="Times-Roman" fontSize="10.0" leading="11" alignment="CENTER"/> |
221 | + <paraStyle name="P13" fontName="Times-Roman" fontSize="10.0" leading="11" alignment="RIGHT"/> |
222 | + <paraStyle name="P16" fontName="Times-Bold" fontSize="10.0" leading="11" alignment="RIGHT"/> |
223 | + <paraStyle name="P14" fontName="Times-Roman" fontSize="10.0" leading="11" alignment="LEFT"/> |
224 | + <paraStyle name="P17" fontName="Times-Bold" fontSize="10.0" leading="11" alignment="LEFT"/> |
225 | + <paraStyle name="P22" fontName="Times-Roman" fontSize="9.0" leading="11" spaceBefore="0.0" spaceAfter="6.0" alignment="RIGHT"/> |
226 | </stylesheet> |
227 | <images/> |
228 | |
229 | <story> |
230 | <para>[[repeatIn(objects,'o')]]</para> |
231 | <para>[[ setLang(company.partner_id.lang) ]]</para> |
232 | - <blockTable colWidths="410.0,198.0,50.0,50.0,45.0" repeatRows='1' style="Tabla3"> |
233 | -<!-- |
234 | - <blockTable colWidths="75.0,335.0,68.0,50.0,80.0,60.0,85.0" repeatRows='1' style="Tabla3"> |
235 | ---> |
236 | + <blockTable colWidths="18.00mm,22.00mm,48.00mm,8.00mm,8.00mm,22.00mm,20.00mm,22.00mm,20.00mm,20.00mm,18.00mm,20.00mm,20.00mm" repeatRows='1' style="Tabla3"> |
237 | <tr> |
238 | - <td><para style="P15">RIF Contribuyente</para></td> |
239 | - <td><para style="P15">Periodo</para></td> |
240 | - <td><para style="P15">Fecha Doc.</para></td> |
241 | + <td><para style="P15">Fecha</para></td> |
242 | + <td><para style="P15">RIF</para></td> |
243 | + <td><para style="P15">Nombre</para></td> |
244 | + <td><para style="P15">Tipo Doc.</para></td> |
245 | <td><para style="P15">Tipo Ope.</para></td> |
246 | - <td><para style="P15">Tipo Doc.</para></td> |
247 | -<!-- |
248 | - <td><para style="P15">RIF C/V</para></td> |
249 | <td><para style="P15">Num Doc.</para></td> |
250 | <td><para style="P15">Num Control</para></td> |
251 | - <td><para style="P15">Monto Doc.</para></td> |
252 | + <td><para style="P15">Monto Total</para></td> |
253 | <td><para style="P15">Base Impo.</para></td> |
254 | - <td><para style="P15">Monto IVA</para></td> |
255 | - <td><para style="P15">Num.Doc.Afec.</para></td> |
256 | - <td><para style="P15">Num.Compro.</para></td> |
257 | + <td><para style="P15">IVA Reten.</para></td> |
258 | + <td><para style="P15">Num. Doc. Afec.</para></td> |
259 | <td><para style="P15">Monto Exc. IVA</para></td> |
260 | <td><para style="P15">Alicuota</para></td> |
261 | - <td><para style="P15">Expediente</para></td> |
262 | ---> |
263 | </tr> |
264 | <tr>[[repeatIn(o.txt_ids,'line')]] |
265 | - <td><para style="P12">[[ '98798' ]]</para></td> |
266 | - <td><para style="P14">[[ o.period_id.name ]]</para></td> |
267 | <td><para style="P12">[[ line.invoice_id.date_invoice ]]</para></td> |
268 | + <td><para style="P12">[[ line.invoice_id.partner_id.vat and ('%s-%s-%s'%(line.invoice_id.partner_id.vat[2:3],line.invoice_id.partner_id.vat[3:11],line.invoice_id.partner_id.vat[11:12])) or '' ]]</para></td> |
269 | + <td><para style="P14">[[ line.invoice_id.partner_id and line.invoice_id.partner_id.name or '' ]]</para></td> |
270 | <td><para style="P12">[[ (line.invoice_id.type in ['out_invoice','out_refund']) and 'V' or 'C' ]]</para></td> |
271 | - <td><para style="P13">[[ get_type_doc(line) ]]</para></td> |
272 | - |
273 | -<!-- |
274 | - <td><para style="P13">[[ ]]</para></td> |
275 | - <td><para style="P13">[[ ]]</para></td> |
276 | - <td><para style="P13">[[ ]]</para></td> |
277 | - <td><para style="P13">[[ ]]</para></td> |
278 | - <td><para style="P13">[[ ]]</para></td> |
279 | - <td><para style="P13">[[ ]]</para></td> |
280 | - <td><para style="P13">[[ ]]</para></td> |
281 | - <td><para style="P13">[[ ]]</para></td> |
282 | - <td><para style="P13">[[ ]]</para></td> |
283 | - <td><para style="P13">[[ ]]</para></td> |
284 | - <td><para style="P13">[[ ]]</para></td> |
285 | ---> |
286 | - </tr> |
287 | - </blockTable> |
288 | - <blockTable colWidths="410.0,198.0,145.0" style="TOTAL"> |
289 | - <tr> |
290 | - <td><para style="P22"><font color="white"></font></para></td> |
291 | - <td><para style="P16">TOTAL BASE IMPONIBLE</para></td> |
292 | - <td><para style="P16">[[ formatLang(o.amount_total_base) ]]</para></td> |
293 | - </tr> |
294 | - <tr> |
295 | - <td><para style="P22"><font color="white"></font></para></td> |
296 | - <td><para style="P16">TOTAL MONTO DE RETENCION</para></td> |
297 | - <td><para style="P16">[[ formatLang(o.amount_total_ret) ]]</para></td> |
298 | - </tr> |
299 | - </blockTable> |
300 | - |
301 | + <td><para style="P12">[[ get_type_doc(line) ]]</para></td> |
302 | + <td><para style="P12">[[ get_doc_number(o.id,line) ]]</para></td> |
303 | + <td><para style="P12">[[ get_ctrl_number(line) ]]</para></td> |
304 | + <td><para style="P13">[[ formatLang(round(line.invoice_id.amount_total,2)) ]]</para></td> |
305 | + <td><para style="P13">[[ formatLang(round( get_amount_untaxed(line),2)) ]]</para></td> |
306 | + <td><para style="P13">[[ formatLang(round(line.amount_withheld,2)) ]]</para></td> |
307 | + <td><para style="P12">[[ get_doc_affected(line) ]]</para></td> |
308 | + <td><para style="P13">[[ formatLang(round(get_amount_exempt(line),2)) ]]</para></td> |
309 | + <td><para style="P12">[[ formatLang(get_alicuota(line)) ]]</para></td> |
310 | + </tr> |
311 | + </blockTable> |
312 | + |
313 | + <blockTable colWidths="18.00mm,22.00mm,48.00mm,8.00mm,8.00mm,22.00mm,20.00mm,22.00mm,20.00mm,20.00mm,18.00mm,20.00mm,20.00mm" repeatRows='1' style="Tabla3"> |
314 | + <tr> |
315 | + <td><para style="P15"></para></td> |
316 | + <td><para style="P15"></para></td> |
317 | + <td><para style="P15"></para></td> |
318 | + <td><para style="P15"></para></td> |
319 | + <td><para style="P15"></para></td> |
320 | + <td><para style="P15"></para></td> |
321 | + <td><para style="P15">Total</para></td> |
322 | + <td><para style="P15">[[ formatLang(get_total_amount_doc(o.id)) ]]</para></td> |
323 | + <td><para style="P15">[[ formatLang(get_total_amount_untaxed()) ]]</para></td> |
324 | + <td><para style="P15">[[ formatLang(o.amount_total_ret) ]]</para></td> |
325 | + <td><para style="P15"></para></td> |
326 | + <td><para style="P15">[[ formatLang(get_total_amount_exempt()) ]]</para></td> |
327 | + <td><para style="P15"></para></td> |
328 | + </tr> |
329 | + </blockTable> |
330 | + <blockTable colWidths="50mm,120mm" style="LEGEND"> |
331 | + <tr> |
332 | + <td><para style="P16">Tipo de Operación:</para></td> |
333 | + <td><para style="P14">C=compra; V=ventas</para></td> |
334 | + </tr> |
335 | + <tr> |
336 | + <td><para style="P16">Tipo de documento</para></td> |
337 | + <td><para style="P14">01=Factura; 02=Nota de Debito; 03=Notas de Créditos</para></td> |
338 | + </tr> |
339 | + </blockTable> |
340 | </story> |
341 | |
342 | </document> |