Merge lp:~vauxoo/openerp-mexico-localization/7.0-l10n_mx_diot_report_add_csv_file_dev_ernesto into lp:openerp-mexico-localization/7.0

Status: Superseded
Proposed branch: lp:~vauxoo/openerp-mexico-localization/7.0-l10n_mx_diot_report_add_csv_file_dev_ernesto
Merge into: lp:openerp-mexico-localization/7.0
Diff against target: 231 lines (+128/-4)
4 files modified
l10n_mx_diot_report/i18n/es.po (+10/-0)
l10n_mx_diot_report/i18n/es_MX.po (+10/-0)
l10n_mx_diot_report/wizard/wizard_diot_report.py (+106/-3)
l10n_mx_diot_report/wizard/wizard_diot_report_view.xml (+2/-1)
To merge this branch: bzr merge lp:~vauxoo/openerp-mexico-localization/7.0-l10n_mx_diot_report_add_csv_file_dev_ernesto
Reviewer Review Type Date Requested Status
Luis Ernesto García Medina - http://www.vauxoo.com (community) Needs Resubmitting
Isaac López Zúñiga Pending
Moisés López - http://www.vauxoo.com Pending
Review via email: mp+181937@code.launchpad.net

This proposal has been superseded by a proposal from 2013-08-26.

Description of the change

Se agrego el archivo CSV con los titulos de las columnas (se generan ambos archivos TXT y CSV) y se agrego help a los dos archivos

To post a comment you must log in.
Revision history for this message
Luis Ernesto García Medina - http://www.vauxoo.com (ernesto-gm) wrote :

Se agregaron los totales de los impuestos al archivo CSV

review: Needs Resubmitting
259. By Luis Ernesto García Medina - http://www.vauxoo.com

[IMP][l10n_mx_diot_report] add total of tax in file CSV

260. By Luis Ernesto García Medina - http://www.vauxoo.com

[IMP][l10n_mx_diot_report] changed view of wizard (order of download files CSV and TXT) and changed text in help of files

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_mx_diot_report/i18n/es.po'
2--- l10n_mx_diot_report/i18n/es.po 2013-08-21 05:50:27 +0000
3+++ l10n_mx_diot_report/i18n/es.po 2013-08-24 04:09:29 +0000
4@@ -77,6 +77,11 @@
5 msgstr "CO - Colombia"
6
7 #. module: l10n_mx_diot_report
8+#: help:account.diot.report,file:0
9+msgid "This is File for export to SAT"
10+msgstr "Este es el archivo para exportar al SAT"
11+
12+#. module: l10n_mx_diot_report
13 #: selection:res.partner,type_of_operation:0
14 msgid " 85 - Others"
15 msgstr " 85 - Otros"
16@@ -192,6 +197,11 @@
17 msgstr "GU - Guam"
18
19 #. module: l10n_mx_diot_report
20+#: help:account.diot.report,file_csv:0
21+msgid "This is the file to collate"
22+msgstr "Este es el archivo para cotejar"
23+
24+#. module: l10n_mx_diot_report
25 #: selection:res.partner,diot_country:0
26 msgid "CR - Republica de Costa Rica"
27 msgstr "CR - Republica de Costa Rica"
28
29=== modified file 'l10n_mx_diot_report/i18n/es_MX.po'
30--- l10n_mx_diot_report/i18n/es_MX.po 2013-08-21 05:50:27 +0000
31+++ l10n_mx_diot_report/i18n/es_MX.po 2013-08-24 04:09:29 +0000
32@@ -79,6 +79,11 @@
33 msgstr "CO - Colombia"
34
35 #. module: l10n_mx_diot_report
36+#: help:account.diot.report,file:0
37+msgid "This is File for export to SAT"
38+msgstr "Este es el archivo para exportar al SAT"
39+
40+#. module: l10n_mx_diot_report
41 #: selection:res.partner,type_of_operation:0
42 msgid " 85 - Others"
43 msgstr " 85 - Otros"
44@@ -194,6 +199,11 @@
45 msgstr "GU - Guam"
46
47 #. module: l10n_mx_diot_report
48+#: help:account.diot.report,file_csv:0
49+msgid "This is the file to collate"
50+msgstr "Este es el archivo para cotejar"
51+
52+#. module: l10n_mx_diot_report
53 #: selection:res.partner,diot_country:0
54 msgid "CR - Republica de Costa Rica"
55 msgstr "CR - Republica de Costa Rica"
56
57=== modified file 'l10n_mx_diot_report/wizard/wizard_diot_report.py'
58--- l10n_mx_diot_report/wizard/wizard_diot_report.py 2013-08-23 18:22:48 +0000
59+++ l10n_mx_diot_report/wizard/wizard_diot_report.py 2013-08-24 04:09:29 +0000
60@@ -45,7 +45,9 @@
61 help='Select period', required=True),
62 'filename': fields.char('File name', size=128, readonly=True,
63 help='This is File name'),
64- 'file': fields.binary('File', readonly=True),
65+ 'filename_csv': fields.char('File name', size=128, readonly=True),
66+ 'file': fields.binary('File', readonly=True, help='This is File for export to SAT'),
67+ 'file_csv': fields.binary('File', readonly=True, help='This is the file to collate'),
68 'state': fields.selection([('choose', 'Choose'), ('get', 'Get'),
69 ('not_file', 'Not File')]),
70 }
71@@ -196,7 +198,7 @@
72 'domain': [('id', 'in', partner_ids_to_fix), '|', (
73 'active', '=', False), ('active', '=', True)],
74 }
75- (fileno, fname) = tempfile.mkstemp('.csv', 'tmp')
76+ (fileno, fname) = tempfile.mkstemp('.txt', 'tmp')
77 os.close(fileno)
78 f_write = open(fname, 'wb')
79 fcsv = csv.DictWriter(f_write,
80@@ -223,6 +225,34 @@
81 'tax Withheld by the taxpayer',
82 'VAT for returns, discounts and rebates on purchases',
83 'show_pipe', ], delimiter='|')
84+
85+ (fileno, fname_csv) = tempfile.mkstemp('.csv', 'tmp_csv')
86+ os.close(fileno)
87+ f_write_csv = open(fname_csv, 'wb')
88+ fcsv_csv = csv.DictWriter(f_write_csv,
89+ ['type_of_third', 'type_of_operation',
90+ 'vat', 'number_id_fiscal', 'foreign_name',
91+ 'country_of_residence', 'nationality',
92+ 'value_of_acts_or_activities_paid_at_the_rate_of_16%',
93+ 'value_of_acts_or_activities_paid_at_the_rate_of_15%',
94+ 'amount_of_non-creditable_VAT_paid_at_the_rate_of_16%',
95+ 'value_of_acts_or_activities_paid_at_the_rate_of_11%_VAT',
96+ 'value_of_acts_or_activities_paid_at_the_rate_of_10%_VAT',
97+ 'amount_of_non-creditable_VAT_paid_at_the_rate_of_11%',
98+ 'value_of_acts_or_activities_paid_on_import_of_goods_and_'
99+ 'services_at_the_rate_of_16%_VAT',
100+ 'amount_of_non-creditable_VAT_paid_by_imports_at_the_rate_of_16%',
101+ 'value_of_acts_or_activities_paid_on_import_of_goods_and_'
102+ 'services_at_the_rate_of_11%_VAT',
103+ 'amount_of_non-creditable_VAT_paid_by_imports_at_the_rate_of_11%',
104+ 'value_of_acts_or_activities_paid_on_import_of_goods_and_'
105+ 'services_for_which_VAT_is_not_pay_(exempt)',
106+ 'value_of_the_other_acts_or_activities_paid_at_the_rate_of_0%_VAT',
107+ 'value_of_acts_or_activities_paid_by_those_who_do_not_pay_the_'
108+ 'VAT_(Exempt)',
109+ 'tax Withheld by the taxpayer',
110+ 'VAT for returns, discounts and rebates on purchases',
111+ 'show_pipe', ], delimiter=',')
112 for diot in dic_move_line:
113 diot_list = dic_move_line.get(diot, False)
114 if diot_list and sum(diot_list[7:12]) == 0:
115@@ -242,6 +272,45 @@
116 'type': 'ir.actions.act_window',
117 'domain': [('id', 'in', account_move_line_id)],
118 }
119+ fcsv_csv.writerow(
120+ {'type_of_third' : 'Tipo de tercero', 'type_of_operation' :\
121+ 'Tipo de operación', 'vat' : 'RFC', 'number_id_fiscal' : \
122+ 'Número de ID fiscal', 'foreign_name' : 'Nombre del extranjero',
123+ 'country_of_residence' : 'País de residencia', 'nationality' : 'Nacionalidad',
124+ 'value_of_acts_or_activities_paid_at_the_rate_of_16%' : \
125+ 'Valor de los actos o actividades pagados a la tasa del 15% ó 16% de IVA',
126+ 'value_of_acts_or_activities_paid_at_the_rate_of_15%' : \
127+ 'Valor de los actos o actividades pagados a la tasa del 15% de IVA',
128+ 'amount_of_non-creditable_VAT_paid_at_the_rate_of_16%' : \
129+ 'Monto del IVA pagado no acreditable a la tasa del 15% ó 16%',
130+ 'value_of_acts_or_activities_paid_at_the_rate_of_11%_VAT' : \
131+ 'Valor de los actos o actividades pagados a la tasa del 10% u 11% de IVA',
132+ 'value_of_acts_or_activities_paid_at_the_rate_of_10%_VAT' : \
133+ 'Valor de los actos o actividades pagados a la tasa del 10% de IVA',
134+ 'amount_of_non-creditable_VAT_paid_at_the_rate_of_11%' : \
135+ 'Monto del IVA pagado no acreditable a la tasa del 10% u 11%',
136+ 'value_of_acts_or_activities_paid_on_import_of_goods_and_services_at_the_rate_of_16%_VAT' : \
137+ 'Valor de los actos o actividades pagados en la importación de bienes y servicios a la tasa del 15% ó 16% de IVA',
138+ 'amount_of_non-creditable_VAT_paid_by_imports_at_the_rate_of_16%' : \
139+ 'Monto del IVA pagado no acreditable por la importacion a la tasa del 15% ó 16%',
140+ 'value_of_acts_or_activities_paid_on_import_of_goods_and_services_at_the_rate_of_11%_VAT' : \
141+ 'Valor de los actos o actividades pagados en la importacion de bienes y servicios a la tasa del 10% u 11% de IVA',
142+ 'amount_of_non-creditable_VAT_paid_by_imports_at_the_rate_of_11%' : \
143+ 'Monto del IVA pagado no acreditable por la importacion a la tasa del 10% u 11%',
144+ 'value_of_acts_or_activities_paid_on_import_of_goods_and_services_for_which_VAT_is_not_pay_(exempt)' : \
145+ 'Valor de los actos o actividades pagados en la importación de bienes y servicios por los que no se paragá el IVA (Exentos)',
146+ 'value_of_the_other_acts_or_activities_paid_at_the_rate_of_0%_VAT' : \
147+ 'Valor de los demás actos o actividades pagados a la tasa del 0% de IVA',
148+ 'value_of_acts_or_activities_paid_by_those_who_do_not_pay_the_VAT_(Exempt)' : \
149+ 'Valor de los actos o actividades pagados por los que no se pagará el IVA (Exentos)',
150+ 'tax Withheld by the taxpayer' : 'IVA Retenido por el contribuyente',
151+ 'VAT for returns, discounts and rebates on purchases' : ' IVA correspondiente a las devoluciones, descuentos y bonificaciones'
152+ })
153+ sum_dic = {'type_of_third': '', 'value_of_acts_or_activities_paid_at_the_rate_of_16%' : 0,
154+ 'value_of_acts_or_activities_paid_at_the_rate_of_11%_VAT' : 0,
155+ 'value_of_the_other_acts_or_activities_paid_at_the_rate_of_0%_VAT' : 0,
156+ 'value_of_acts_or_activities_paid_by_those_who_do_not_pay_the_VAT_(Exempt)' : 0,
157+ 'tax Withheld by the taxpayer' : 0}
158 for diot in dic_move_line:
159 values_diot = dic_move_line.get(diot, False)
160 fcsv.writerow(
161@@ -262,13 +331,45 @@
162 '_VAT_(Exempt)': int(round((values_diot[10]), 0)),
163 'tax Withheld by the taxpayer': int(round((values_diot[11]), 0)),
164 })
165+ sum_dic.update({'value_of_acts_or_activities_paid_at_the_rate_of_16%' : sum_dic['value_of_acts_or_activities_paid_at_the_rate_of_16%'] + int(round((values_diot[7]), 0)),
166+ 'value_of_acts_or_activities_paid_at_the_rate_of_11%_VAT' : sum_dic['value_of_acts_or_activities_paid_at_the_rate_of_11%_VAT'] + int(round((values_diot[8]), 0)),
167+ 'value_of_the_other_acts_or_activities_paid_at_the_rate_of_0%_VAT' : sum_dic['value_of_the_other_acts_or_activities_paid_at_the_rate_of_0%_VAT'] + int(round((values_diot[9]), 0)),
168+ 'value_of_acts_or_activities_paid_by_those_who_do_not_pay_the_VAT_(Exempt)' : sum_dic['value_of_acts_or_activities_paid_by_those_who_do_not_pay_the_VAT_(Exempt)'] + int(round((values_diot[10]), 0)),
169+ 'tax Withheld by the taxpayer' : sum_dic['tax Withheld by the taxpayer'] + int(round((values_diot[11]), 0)),
170+ 'type_of_third': 'Total'})
171+ fcsv_csv.writerow(
172+ {'type_of_third': values_diot[0],
173+ 'type_of_operation': values_diot[1],
174+ 'vat': values_diot[2],
175+ 'number_id_fiscal': values_diot[3],
176+ 'foreign_name': values_diot[4],
177+ 'country_of_residence': values_diot[5],
178+ 'nationality': values_diot[6],
179+ 'value_of_acts_or_activities_paid_at_the_rate_of_16%': int(
180+ round((values_diot[7]), 0)),
181+ 'value_of_acts_or_activities_paid_at_the_rate_of_11%_VAT': int(
182+ round((values_diot[8]), 0)),
183+ 'value_of_the_other_acts_or_activities_paid_at_the_rate_of'
184+ '_0%_VAT': int(round((values_diot[9]), 0)),
185+ 'value_of_acts_or_activities_paid_by_those_who_do_not_pay_the'
186+ '_VAT_(Exempt)': int(round((values_diot[10]), 0)),
187+ 'tax Withheld by the taxpayer': int(round((values_diot[11]), 0)),
188+ })
189+ fcsv_csv.writerow(sum_dic)
190 f_write.close()
191+ f_write_csv.close()
192 f_read = file(fname, "rb")
193 fdata = f_read.read()
194 out = base64.encodestring(fdata)
195 name = "%s-%s-%s.txt" % ("OPENERP-DIOT", this.company_id.name,
196 strftime('%Y-%m-%d'))
197 f_read.close()
198+ f_read_csv = file(fname_csv, "rb")
199+ fdata_csv = f_read_csv.read()
200+ out_csv = base64.encodestring(fdata_csv)
201+ name_csv = "%s-%s-%s.csv" % ("OPENERP-DIOT", this.company_id.name,
202+ strftime('%Y-%m-%d'))
203+ f_read.close()
204 datas = {'ids': context.get('active_ids', [])}
205 res = self.read(cr, uid, ids, ['time_unit', 'measure_unit'])
206 res = res and res[0] or {}
207@@ -279,7 +380,9 @@
208 state = 'not_file'
209 self.write(cr, uid, ids, {'state': state,
210 'file': out,
211- 'filename': name
212+ 'file_csv' : out_csv,
213+ 'filename': name,
214+ 'filename_csv' : name_csv,
215 }, context=context)
216 return {
217 'type': 'ir.actions.act_window',
218
219=== modified file 'l10n_mx_diot_report/wizard/wizard_diot_report_view.xml'
220--- l10n_mx_diot_report/wizard/wizard_diot_report_view.xml 2013-07-24 22:47:29 +0000
221+++ l10n_mx_diot_report/wizard/wizard_diot_report_view.xml 2013-08-24 04:09:29 +0000
222@@ -15,7 +15,8 @@
223 </group>
224 <div states="get">
225 <h2>You DIOT report has been successfully created!</h2>
226- <p>Here is the exported DIOT Report file: <field name="file" readonly="1" filename="filename"/></p>
227+ <p>Here is the exported DIOT Report file:</p>
228+ <p>TXT: <field name="file" readonly="1" filename="filename"/> CSV: <field name="file_csv" readonly="1" filename="filename_csv"/></p>
229 </div>
230 <div states="not_file">
231 <h2>You DIOT report not has been created!</h2>