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

Status: Merged
Merged at revision: 325
Proposed branch: lp:~vauxoo/openerp-mexico-localization/7.0_oml_test_yaml_diot_dev_jorge
Merge into: lp:openerp-mexico-localization/7.0
Diff against target: 319 lines (+278/-2)
5 files modified
l10n_mx_diot_report/__openerp__.py (+6/-2)
l10n_mx_diot_report/demo/account_invoice_demo.xml (+84/-0)
l10n_mx_diot_report/demo/account_voucher_tax_demo.xml (+47/-0)
l10n_mx_diot_report/demo/res_partner_demo.xml (+12/-0)
l10n_mx_diot_report/test/validate_diot.yml (+129/-0)
To merge this branch: bzr merge lp:~vauxoo/openerp-mexico-localization/7.0_oml_test_yaml_diot_dev_jorge
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Approve
Jorge Angel Naranjo Rogel - http://www.vauxoo.com Needs Resubmitting
Nhomar - Vauxoo Needs Fixing
Julio Serna-http://www.vauxoo.com Pending
Isaac López Zúñiga Pending
Review via email: mp+192985@code.launchpad.net

Description of the change

Se agrega Test yaml para validar la información del reporte de diot. Se configuran los impuestos que se crearon en account_voucer_tax para su funcionamiento del Diot.

To post a comment you must log in.
324. By Jorge Angel Naranjo Rogel - http://www.vauxoo.com

[IMP][l10n_mx_diot_report] Changed not is to is not

Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :
review: Needs Fixing
325. By Jorge Angel Naranjo Rogel - http://www.vauxoo.com

[FIX][l10n_mx_diot_report] Changed eval to search by name

Revision history for this message
Jorge Angel Naranjo Rogel - http://www.vauxoo.com (jorge-nr) wrote :

Se cambia el eval por un search para que traiga el id que le corresponde

review: Needs Resubmitting
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_mx_diot_report/__openerp__.py'
2--- l10n_mx_diot_report/__openerp__.py 2013-07-22 20:43:26 +0000
3+++ l10n_mx_diot_report/__openerp__.py 2013-11-05 17:58:57 +0000
4@@ -52,8 +52,12 @@
5 "l10n_mx_account_tax_category",
6 "l10n_mx_base_vat_split",
7 "account_voucher_tax",
8+ "account_voucher",
9+ "l10n_mx_partner_address",
10 ],
11- "demo" : [],
12+ "demo" : ["demo/account_voucher_tax_demo.xml",
13+ "demo/res_partner_demo.xml",
14+ "demo/account_invoice_demo.xml",],
15 "data" : [
16 "partner_view.xml",
17 "wizard/wizard_diot_report_view.xml",
18@@ -61,7 +65,7 @@
19 'js': [],
20 'qweb' : [],
21 'css':[],
22- 'test': [],
23+ 'test': ["test/validate_diot.yml",],
24 "installable" : True,
25 "active" : False,
26 }
27
28=== added directory 'l10n_mx_diot_report/demo'
29=== added file 'l10n_mx_diot_report/demo/account_invoice_demo.xml'
30--- l10n_mx_diot_report/demo/account_invoice_demo.xml 1970-01-01 00:00:00 +0000
31+++ l10n_mx_diot_report/demo/account_invoice_demo.xml 2013-11-05 17:58:57 +0000
32@@ -0,0 +1,84 @@
33+<?xml version="1.0" encoding="utf-8"?>
34+<openerp>
35+ <data noupdate="1">
36+
37+<!--
38+ Invoices
39+-->
40+ <record id="account_invoice_diot_0" model="account.invoice">
41+ <field name="date_due" eval="time.strftime('%Y-%m-%d')"/>
42+ <field name="currency_id" ref="base.EUR"/>
43+ <field name="reference_type">none</field>
44+ <field name="account_id" ref="account.a_pay"/>
45+ <field name="payment_term" ref="account.account_payment_term"/>
46+ <field name="reference_type">none</field>
47+ <field name="journal_id" ref="account.expenses_journal"/>
48+ <field name="state">draft</field>
49+ <field name="type">in_invoice</field>
50+ <field name="date_invoice" eval="time.strftime('%Y-%m-%d')"/>
51+ <field name="partner_id" ref="l10n_mx_partner_address.res_partner_address_vauxoo_1"/>
52+ </record>
53+
54+ <record id="account_invoice_diot_0_line1" model="account.invoice.line">
55+ <field name="invoice_id" ref="account_invoice_diot_0"/>
56+ <field name="account_id" ref="account.a_expense"/>
57+ <field name="uos_id" ref="product.product_uom_unit"/>
58+ <field name="price_unit" eval="100.0" />
59+ <field name="company_id" ref="base.main_company"/>
60+ <field name="invoice_line_tax_id" eval="[(6,0,[ref('account_voucher_tax.account_voucher_tax_purchase_iva16')])]"/>
61+ <field name="product_id" ref="product.product_product_3"/>
62+ <field name="quantity" eval="1.0" />
63+ <field name="partner_id" ref="l10n_mx_partner_address.res_partner_address_vauxoo_1"/>
64+ <field name="name">PC Assemble SC234</field>
65+ </record>
66+ <record id="account_invoice_diot_0_line2" model="account.invoice.line">
67+ <field name="invoice_id" ref="account_invoice_diot_0"/>
68+ <field name="account_id" ref="account.a_expense"/>
69+ <field name="uos_id" ref="product.product_uom_unit"/>
70+ <field name="price_unit" eval="100.0" />
71+ <field name="company_id" ref="base.main_company"/>
72+ <field name="invoice_line_tax_id" eval="[(6,0,[ref('account_voucher_tax.account_voucher_tax_purchase_iva11')])]"/>
73+ <field name="product_id" ref="product.product_product_5"/>
74+ <field name="quantity" eval="1.0" />
75+ <field name="partner_id" ref="l10n_mx_partner_address.res_partner_address_vauxoo_1"/>
76+ <field name="name">PC Assemble + Custom (PC on Demand)</field>
77+ </record>
78+ <record id="account_invoice_diot_0_line3" model="account.invoice.line">
79+ <field name="invoice_id" ref="account_invoice_diot_0"/>
80+ <field name="account_id" ref="account.a_expense"/>
81+ <field name="uos_id" ref="product.product_uom_unit"/>
82+ <field name="price_unit" eval="100.0" />
83+ <field name="company_id" ref="base.main_company"/>
84+ <field name="invoice_line_tax_id" eval="[(6,0,[ref('account_voucher_tax.account_voucher_tax_purchase_iva1067_retencion_iva')])]"/>
85+ <field name="product_id" ref="product.product_product_22"/>
86+ <field name="quantity" eval="1.0" />
87+ <field name="partner_id" ref="l10n_mx_partner_address.res_partner_address_vauxoo_1"/>
88+ <field name="name">Processor Core i5 2.70 Ghz</field>
89+ </record>
90+ <record id="account_invoice_diot_0_line4" model="account.invoice.line">
91+ <field name="invoice_id" ref="account_invoice_diot_0"/>
92+ <field name="account_id" ref="account.a_expense"/>
93+ <field name="uos_id" ref="product.product_uom_unit"/>
94+ <field name="price_unit" eval="100.0" />
95+ <field name="company_id" ref="base.main_company"/>
96+ <field name="invoice_line_tax_id" eval="[(6,0,[ref('account_voucher_tax.account_voucher_tax_purchase_iva_excento_iva')])]"/>
97+ <field name="product_id" ref="product.product_product_20"/>
98+ <field name="quantity" eval="1.0" />
99+ <field name="partner_id" ref="l10n_mx_partner_address.res_partner_address_vauxoo_1"/>
100+ <field name="name">Motherboard I9P57</field>
101+ </record>
102+ <record id="account_invoice_diot_0_line5" model="account.invoice.line">
103+ <field name="invoice_id" ref="account_invoice_diot_0"/>
104+ <field name="account_id" ref="account.a_expense"/>
105+ <field name="uos_id" ref="product.product_uom_unit"/>
106+ <field name="price_unit" eval="100.0" />
107+ <field name="company_id" ref="base.main_company"/>
108+ <field name="invoice_line_tax_id" eval="[(6,0,[ref('account_voucher_tax.account_voucher_tax_purchase_0iva')])]"/>
109+ <field name="product_id" ref="product.product_product_25"/>
110+ <field name="quantity" eval="1.0" />
111+ <field name="partner_id" ref="l10n_mx_partner_address.res_partner_address_vauxoo_1"/>
112+ <field name="name">Laptop E5023</field>
113+ </record>
114+
115+ </data>
116+</openerp>
117
118=== added file 'l10n_mx_diot_report/demo/account_voucher_tax_demo.xml'
119--- l10n_mx_diot_report/demo/account_voucher_tax_demo.xml 1970-01-01 00:00:00 +0000
120+++ l10n_mx_diot_report/demo/account_voucher_tax_demo.xml 2013-11-05 17:58:57 +0000
121@@ -0,0 +1,47 @@
122+<?xml version="1.0" ?>
123+<openerp>
124+ <data noupdate="0">
125+
126+ <record id="account_voucher_tax.account_voucher_tax_purchase_iva16" model="account.tax">
127+ <field name="name">IVA 16% with purchase voucher accounts - Test</field>
128+ <field model="account.tax.category" name="tax_category_id" search="[('name','like','IVA')]"/>
129+ </record>
130+
131+ <record id="account_voucher_tax.account_voucher_tax_purchase_iva11" model="account.tax">
132+ <field name="name">IVA 11% with purchase voucher accounts - Test</field>
133+ <field model="account.tax.category" name="tax_category_id" search="[('name','like','IVA')]"/>
134+ </record>
135+
136+ <record id="account_voucher_tax.account_voucher_tax_purchase_iva533" model="account.tax">
137+ <field name="name">IVA 5.33% X ACREDITAR - Test</field>
138+ <field name="tax_diot">tax_16</field>
139+ <field model="account.tax.category" name="tax_category_id" search="[('name','like','IVA')]"/>
140+ </record>
141+
142+ <record id="account_voucher_tax.account_voucher_tax_purchase_iva1067_xacre_retenido" model="account.tax">
143+ <field name="name">IVA 10.67% X ACREDITAR RETENIDO- Test</field>
144+ <field name="tax_diot">tax_ret</field>
145+ <field model="account.tax.category" name="tax_category_id" search="[('name','like','IVA-RET')]"/>
146+ </record>
147+
148+ <record id="account_voucher_tax.account_voucher_tax_purchase_iva10_rete_isr" model="account.tax">
149+ <field name="name">IVA 10% RETENIDO ISR - Test</field>
150+ <field model="account.tax.category" name="tax_category_id" search="[('name','like','ISR-RET')]"/>
151+ </record>
152+
153+ <record id="account_voucher_tax.account_voucher_tax_purchase_iva1067_retencion_iva" model="account.tax">
154+ <field name="name">RETENCION IVA 10.67% - Test</field>
155+ <field model="account.tax.category" name="tax_category_id" search="[('name','like','IVA-RET')]"/>
156+ </record>
157+
158+ <record id="account_voucher_tax.account_voucher_tax_purchase_0iva" model="account.tax">
159+ <field name="name">IVA 0% purchase - Test</field>
160+ <field model="account.tax.category" name="tax_category_id" search="[('name','like','IVA')]"/>
161+ </record>
162+
163+ <record id="account_voucher_tax.account_voucher_tax_purchase_iva_excento_iva" model="account.tax">
164+ <field name="name">IVA EXENTO - Test</field>
165+ <field model="account.tax.category" name="tax_category_id" search="[('name','like','IVA-EXCENTO')]"/>
166+ </record>
167+ </data>
168+</openerp>
169
170=== added file 'l10n_mx_diot_report/demo/res_partner_demo.xml'
171--- l10n_mx_diot_report/demo/res_partner_demo.xml 1970-01-01 00:00:00 +0000
172+++ l10n_mx_diot_report/demo/res_partner_demo.xml 2013-11-05 17:58:57 +0000
173@@ -0,0 +1,12 @@
174+<?xml version="1.0" ?>
175+<openerp>
176+ <data noupdate="1">
177+
178+ <record id="l10n_mx_partner_address.res_partner_address_vauxoo_0" model="res.partner">
179+ <field eval="1" name="supplier"/>
180+ <field name="type_of_third">04</field>
181+ <field name="type_of_operation">85</field>
182+ </record>
183+
184+ </data>
185+</openerp>
186
187=== added file 'l10n_mx_diot_report/test/validate_diot.yml'
188--- l10n_mx_diot_report/test/validate_diot.yml 1970-01-01 00:00:00 +0000
189+++ l10n_mx_diot_report/test/validate_diot.yml 2013-11-05 17:58:57 +0000
190@@ -0,0 +1,129 @@
191+-
192+ Test DIOT
193+-
194+ I press the update button on the invoice
195+-
196+ !python {model: account.invoice}: |
197+ self.button_reset_taxes(cr, uid, [ref('l10n_mx_diot_report.account_invoice_diot_0')], context=context)
198+-
199+ I getting the amount total of the invoice and write this amount in Verification Total
200+-
201+ !python {model: account.invoice}: |
202+ amount_total = self.read(cr,uid,[ref('l10n_mx_diot_report.account_invoice_diot_0')], ['amount_total'])[0].get('amount_total')
203+ self.write(cr,uid,[ref('l10n_mx_diot_report.account_invoice_diot_0')], {'check_total': amount_total})
204+-
205+ I change the state of invoice to open by clicking Validate button
206+-
207+ !workflow {model: account.invoice, action: invoice_open, ref: l10n_mx_diot_report.account_invoice_diot_0}
208+-
209+ I check that the invoice state is now "Open"
210+-
211+ !assert {model: account.invoice, id: l10n_mx_diot_report.account_invoice_diot_0}:
212+ - state == 'open'
213+-
214+ I set the context that will be used for the encoding of all the vouchers of this file
215+-
216+ !context
217+ 'type': 'payment'
218+-
219+ I create the voucher of payment
220+-
221+ !record {model: account.voucher, id: account_voucher_voucherfordiot0, view: account_voucher.view_vendor_payment_form }:
222+ account_id: account.cash
223+ company_id: base.main_company
224+ journal_id: account.expenses_journal
225+ amount: 516.33
226+ name: 'Voucher for Diot'
227+ partner_id: l10n_mx_partner_address.res_partner_address_vauxoo_0
228+ date: !eval time.strftime('%Y-%m-%d')
229+ payment_option: 'with_writeoff'
230+ writeoff_acc_id: account.a_expense
231+ comment: 'Write Off'
232+ payment_rate_currency_id: base.EUR
233+-
234+ I check the amount of invoice for release the payment
235+-
236+ !python {model: account.invoice}: |
237+ account_voucher_obj = self.pool.get('account.voucher')
238+ amount_total = self.read(cr,uid,[ref('l10n_mx_diot_report.account_invoice_diot_0')], ['amount_total'])[0].get('amount_total')
239+ account_voucher_obj.write(cr,uid,[ref('account_voucher_voucherfordiot0')], {'amount': amount_total})
240+-
241+ I check that Initially customer voucher is in the "Draft" state
242+-
243+ !assert {model: account.voucher, id: account_voucher_voucherfordiot0}:
244+ - state == 'draft'
245+-
246+ I compute the voucher to calculate the taxes by clicking Compute button
247+-
248+ !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucherfordiot0}
249+
250+-
251+ I create voucher by clicking on Create button
252+-
253+ !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucherfordiot0}
254+-
255+ I clicked on Validate Button
256+-
257+ !assert {model: account.voucher, id: account_voucher_voucherfordiot0}:
258+ - state == 'posted'
259+-
260+ I check that Moves get created for this voucher
261+-
262+ !python {model: account.voucher}: |
263+ acc_id=self.browse(cr, uid, ref('account_voucher_voucherfordiot0'))
264+ assert(acc_id.move_id)
265+-
266+ I create a record to wizard diot.
267+-
268+ !record {model: account.diot.report, id: wizard_diot_test_0 , view: l10n_mx_diot_report.view_account_diot_report}:
269+ company_id: base.main_company
270+ entries_to_print: all
271+-
272+ I create file of DIOT and Check Data of Diot
273+-
274+ !python {model: account.diot.report}: |
275+ import base64
276+ import time
277+
278+ account_period_obj = self.pool.get('account.period')
279+ period_id = account_period_obj.search(cr, uid,[('name','like','%'+time.strftime('%m/%Y')+'%')])
280+ data_of_diot = {}
281+ if period_id:
282+ self.write(cr, uid, [ref('wizard_diot_test_0')], {'period_id' : period_id[0]})
283+ create_id = self.create_diot(cr, uid, [ref('wizard_diot_test_0')], context=context)
284+ data = self.read(cr, uid,[create_id.get('res_id')],['file_csv'])
285+ if data:
286+ data_split = base64.decodestring(self.read(cr, uid,[create_id.get('res_id')],['file'])[0].get('file')).split('|')
287+ titles = ['type_of_third', 'type_of_operation',
288+ 'vat', 'number_id_fiscal', 'foreign_name',
289+ 'country_of_residence', 'nationality',
290+ 'value_of_acts_or_activities_paid_at_the_rate_of_16%',
291+ 'value_of_acts_or_activities_paid_at_the_rate_of_15%',
292+ 'amount_of_non-creditable_VAT_paid_at_the_rate_of_16%',
293+ 'value_of_acts_or_activities_paid_at_the_rate_of_11%_VAT',
294+ 'value_of_acts_or_activities_paid_at_the_rate_of_10%_VAT',
295+ 'amount_of_non-creditable_VAT_paid_at_the_rate_of_11%',
296+ 'value_of_acts_or_activities_paid_on_import_of_goods_and_'
297+ 'services_at_the_rate_of_16%_VAT',
298+ 'amount_of_non-creditable_VAT_paid_by_imports_at_the_rate_of_16%',
299+ 'value_of_acts_or_activities_paid_on_import_of_goods_and_'
300+ 'services_at_the_rate_of_11%_VAT',
301+ 'amount_of_non-creditable_VAT_paid_by_imports_at_the_rate_of_11%',
302+ 'value_of_acts_or_activities_paid_on_import_of_goods_and_'
303+ 'services_for_which_VAT_is_not_pay_(exempt)',
304+ 'value_of_the_other_acts_or_activities_paid_at_the_rate_of_0%_VAT',
305+ 'value_of_acts_or_activities_paid_by_those_who_do_not_pay_the_'
306+ 'VAT_(Exempt)',
307+ 'tax Withheld by the taxpayer',
308+ 'VAT for returns, discounts and rebates on purchases',
309+ 'show_pipe', ]
310+ i = 0
311+ for title in titles:
312+ data_of_diot.update({title : data_split[i]})
313+ i+=1
314+
315+ assert int(data_of_diot.get('value_of_acts_or_activities_paid_at_the_rate_of_16%')) == 100 , 'Wrong, Valor de los actos o actividades pagados a la tasa del 15% ó 16% de IVA is not 100'
316+ assert int(data_of_diot.get('value_of_acts_or_activities_paid_at_the_rate_of_11%_VAT')) == 100 , 'Wrong, Valor de los actos o actividades pagados a la tasa del 10% u 11% de IVA is not 100'
317+ assert int(data_of_diot.get('value_of_the_other_acts_or_activities_paid_at_the_rate_of_0%_VAT')) == 100 , 'Wrong, Valor de los demás actos o actividades pagados a la tasa del 0% de IVA is not 100'
318+ assert int(data_of_diot.get('value_of_acts_or_activities_paid_by_those_who_do_not_pay_the_VAT_(Exempt)')) == 100 , 'Wrong, Valor de los actos o actividades pagados por los que no se pagará el IVA (Exentos) is not100'
319+ assert int(data_of_diot.get('tax Withheld by the taxpayer')) == 11 , 'Wrong, IVA Retenido por el contribuyente is not 11'