Merge lp:~vauxoo/openerp-venezuela-localization/7.0-YAML-rev1-dev-kty into lp:~vauxoo/openerp-venezuela-localization/7.0-lp1251135_wh_core-dev-hbto
- 7.0-YAML-rev1-dev-kty
- Merge into 7.0-lp1251135_wh_core-dev-...
Proposed by
Katherine Zaoral (Vauxoo)
Status: | Merged |
---|---|
Approved by: | hbto [Vauxoo] http://www.vauxoo.com |
Approved revision: | 1020 |
Merged at revision: | 949 |
Proposed branch: | lp:~vauxoo/openerp-venezuela-localization/7.0-YAML-rev1-dev-kty |
Merge into: | lp:~vauxoo/openerp-venezuela-localization/7.0-lp1251135_wh_core-dev-hbto |
Diff against target: |
2507 lines (+842/-1406) (has conflicts) 23 files modified
l10n_ve_vat_write_off/i18n/es.po (+5/-0) l10n_ve_withholding_iva/__openerp__.py (+2/-15) l10n_ve_withholding_iva/model/generate_txt.py (+12/-0) l10n_ve_withholding_iva/test/iva_invoice.yml (+0/-41) l10n_ve_withholding_iva/test/iva_purchase.yml (+0/-58) l10n_ve_withholding_iva/test/iva_purchase_nret1.yml (+0/-87) l10n_ve_withholding_iva/test/iva_purchase_nret2.yml (+0/-97) l10n_ve_withholding_iva/test/iva_purchase_nret3.yml (+0/-107) l10n_ve_withholding_iva/test/iva_purchase_wh.yml (+0/-92) l10n_ve_withholding_iva/test/iva_sale.yml (+0/-68) l10n_ve_withholding_iva/test/iva_sale_2.yml (+0/-58) l10n_ve_withholding_iva/test/iva_sale_wh.yml (+0/-205) l10n_ve_withholding_iva/test/iva_sale_withholding.yml (+0/-58) l10n_ve_withholding_iva/test/iva_test_invoice.yml (+0/-67) l10n_ve_withholding_iva/test/iva_test_wh.yml (+0/-57) l10n_ve_withholding_iva/test/iva_test_wh_2.yml (+0/-70) l10n_ve_withholding_iva/test/iva_test_wh_3.yml (+0/-62) l10n_ve_withholding_iva/test/iva_test_wh_4.yml (+0/-60) l10n_ve_withholding_iva/test/purchase_invoice_wh_iva.yml (+11/-0) l10n_ve_withholding_iva/test/purchase_wh_iva.yml (+52/-1) l10n_ve_withholding_iva/test/purchase_wh_iva_sequence.yml (+412/-203) l10n_ve_withholding_iva/test/purchase_wh_iva_txt.yml (+300/-0) l10n_ve_withholding_iva/test/sale_wh_iva.yml (+48/-0) Text conflict in l10n_ve_vat_write_off/i18n/es.po Text conflict in l10n_ve_withholding_iva/test/purchase_wh_iva_sequence.yml |
To merge this branch: | bzr merge lp:~vauxoo/openerp-venezuela-localization/7.0-YAML-rev1-dev-kty |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
hbto [Vauxoo] http://www.vauxoo.com | Approve | ||
Review via email: mp+198415@code.launchpad.net |
Commit message
Description of the change
[MERGE] new test cases for withholding iva module.
To post a comment you must log in.
Revision history for this message
hbto [Vauxoo] http://www.vauxoo.com (humbertoarocha) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'l10n_ve_vat_write_off/i18n/es.po' |
2 | --- l10n_ve_vat_write_off/i18n/es.po 2013-12-08 05:29:01 +0000 |
3 | +++ l10n_ve_vat_write_off/i18n/es.po 2013-12-10 15:12:11 +0000 |
4 | @@ -15,8 +15,13 @@ |
5 | "MIME-Version: 1.0\n" |
6 | "Content-Type: text/plain; charset=UTF-8\n" |
7 | "Content-Transfer-Encoding: 8bit\n" |
8 | +<<<<<<< TREE |
9 | "X-Launchpad-Export-Date: 2013-12-08 05:29+0000\n" |
10 | "X-Generator: Launchpad (build 16869)\n" |
11 | +======= |
12 | +"X-Launchpad-Export-Date: 2013-12-09 05:26+0000\n" |
13 | +"X-Generator: Launchpad (build 16869)\n" |
14 | +>>>>>>> MERGE-SOURCE |
15 | |
16 | #. module: l10n_ve_vat_write_off |
17 | #: view:vat.write.off:0 |
18 | |
19 | === modified file 'l10n_ve_withholding_iva/__openerp__.py' |
20 | --- l10n_ve_withholding_iva/__openerp__.py 2013-12-06 15:57:10 +0000 |
21 | +++ l10n_ve_withholding_iva/__openerp__.py 2013-12-10 15:12:11 +0000 |
22 | @@ -73,26 +73,13 @@ |
23 | ], |
24 | |
25 | 'test': [ |
26 | -# 'test/iva_purchase.yml', |
27 | -# 'test/iva_purchase_wh.yml', |
28 | -# 'test/iva_purchase_nret1.yml', |
29 | -# 'test/iva_purchase_nret2.yml', |
30 | -# 'test/iva_purchase_nret3.yml', |
31 | -# 'test/iva_sale.yml', |
32 | -# 'test/iva_sale_wh.yml', |
33 | -# 'test/iva_test_invoice.yml', |
34 | -# 'test/iva_test_wh.yml', |
35 | -# 'test/iva_test_wh_2.yml', |
36 | -# 'test/iva_test_wh_3.yml', |
37 | -# 'test/iva_test_wh_4.yml', |
38 | - |
39 | - |
40 | 'test/purchase_invoice_wh_iva.yml', |
41 | 'test/sale_invoice_wh_iva.yml', |
42 | 'test/sale_wh_iva.yml', |
43 | 'test/purchase_wh_iva.yml', |
44 | 'test/purchase_wh_iva_sequence.yml', |
45 | - 'test/sale_wh_iva_sequence.yml' |
46 | + 'test/sale_wh_iva_sequence.yml', |
47 | + 'test/purchase_wh_iva_txt.yml', |
48 | ], |
49 | 'installable': True, |
50 | 'active': False, |
51 | |
52 | === modified file 'l10n_ve_withholding_iva/model/generate_txt.py' |
53 | --- l10n_ve_withholding_iva/model/generate_txt.py 2013-12-08 00:14:16 +0000 |
54 | +++ l10n_ve_withholding_iva/model/generate_txt.py 2013-12-10 15:12:11 +0000 |
55 | @@ -120,10 +120,22 @@ |
56 | context = context or {} |
57 | return self.write(cr, uid, ids, {'state':'draft'}) |
58 | |
59 | + def check_txt_ids(self, cr, uid, ids, context=None): |
60 | + """ Check that txt_iva has lines to process.""" |
61 | + context = context or {} |
62 | + ids = isinstance(ids, (int, long)) and [ids] or ids |
63 | + awi_brw = self.browse(cr, uid, ids[0], context=context) |
64 | + if not awi_brw.txt_ids: |
65 | + raise osv.except_osv( |
66 | + _("Missing Values !"), |
67 | + _("Missing VAT TXT Lines!!!")) |
68 | + return True |
69 | + |
70 | def action_confirm(self, cr, uid, ids, context=None): |
71 | """ Transfers the document status to confirmed |
72 | """ |
73 | context = context or {} |
74 | + self.check_txt_ids(cr, uid, ids, context=context) |
75 | return self.write(cr, uid, ids, {'state':'confirmed'}) |
76 | |
77 | def action_generate_lines_txt(self,cr,uid,ids,context=None): |
78 | |
79 | === removed file 'l10n_ve_withholding_iva/test/iva_invoice.yml' |
80 | --- l10n_ve_withholding_iva/test/iva_invoice.yml 2013-04-17 21:42:13 +0000 |
81 | +++ l10n_ve_withholding_iva/test/iva_invoice.yml 1970-01-01 00:00:00 +0000 |
82 | @@ -1,41 +0,0 @@ |
83 | -- |
84 | - In order to test Confirm Draft Invoice wizard I create an invoice and confirm it with this wizard |
85 | -- |
86 | - !record {model: account.invoice, id: account_invoice_state}: |
87 | - account_id: account.a_recv |
88 | - company_id: base.main_company |
89 | - currency_id: base.VEB |
90 | - invoice_line: |
91 | - - product_id: product.product_product_3 |
92 | - account_id: account.a_sale |
93 | - product_qty: 3 |
94 | - uos_id: product.product_uom_unit |
95 | - price_unit: 10 |
96 | - name: PC3 |
97 | - taxes_id: |
98 | - - iva0 |
99 | - journal_id: account.bank_journal |
100 | - partner_id: base.res_partner_desertic_hispafuentes |
101 | - reference_type: none |
102 | -- |
103 | - I check that Initially customer invoice state is "Draft" |
104 | -- |
105 | - !assert {model: account.invoice, id: account_invoice_state}: |
106 | - - state == 'draft' |
107 | -- |
108 | - I called the "Confirm Draft Invoices" wizard |
109 | -- |
110 | - !record {model: account.invoice.confirm, id: account_invoice_confirm_0}: |
111 | - {} |
112 | -- |
113 | - I clicked on Confirm Invoices Button |
114 | -- |
115 | - !python {model: account.invoice.confirm}: | |
116 | - self.invoice_confirm(cr, uid, [ref("account_invoice_confirm_0")], {"lang": 'en_US', |
117 | - "tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_state")], |
118 | - "type": "out_invoice", "active_id": ref("account_invoice_state"), }) |
119 | -- |
120 | - I check that customer invoice state is "Open" |
121 | -- |
122 | - !assert {model: account.invoice, id: account_invoice_state}: |
123 | - - state == 'open' |
124 | |
125 | === removed file 'l10n_ve_withholding_iva/test/iva_purchase.yml' |
126 | --- l10n_ve_withholding_iva/test/iva_purchase.yml 2013-01-15 14:31:52 +0000 |
127 | +++ l10n_ve_withholding_iva/test/iva_purchase.yml 1970-01-01 00:00:00 +0000 |
128 | @@ -1,58 +0,0 @@ |
129 | -- |
130 | - 1. Iva purchase test |
131 | -- |
132 | - 1.1 I create IVA tax |
133 | -- |
134 | - !record {model: account.tax, id: iva_purchase0}: |
135 | - name: 'IVA - Purchase' |
136 | - amount: 0.12 |
137 | - type_tax_use: purchase |
138 | - applicable_type: 'true' |
139 | - company_id: base.main_company |
140 | - ret: False |
141 | -- |
142 | - 1.2 Test if tax was properly created |
143 | -- |
144 | - !assert {model: account.tax, id: iva_purchase0}: |
145 | - - name |
146 | -- |
147 | - 1.3 I update partner information |
148 | -- |
149 | - !record {model: res.partner, id: base.res_partner_23}: |
150 | - wh_iva_agent: True |
151 | - wh_iva_rate: 75 |
152 | - vat_subjected: True |
153 | -- |
154 | - 1.4 Test if information was updated properly |
155 | -- |
156 | - !assert {model: res.partner, id: base.res_partner_23}: |
157 | - - wh_iva_agent |
158 | - - wh_iva_rate == 75 |
159 | - - vat_subjected |
160 | -- |
161 | - 1.5 I update company information |
162 | -- |
163 | - !python {model: res.partner }: | |
164 | - vals = { |
165 | - 'wh_iva_agent': True, |
166 | - 'wh_iva_rate': 75, |
167 | - 'vat_subjected': True |
168 | - } |
169 | - self.write(cr, uid, [ref("base.main_company")], vals) |
170 | -- |
171 | - 1.6 Test if company information was updated properly |
172 | -- |
173 | - !assert {model: res.partner, id: base.main_company}: |
174 | - - wh_iva_agent |
175 | - - wh_iva_rate == 75 |
176 | - - vat_subjected |
177 | -- |
178 | - 1.7 I update IVA tax (withholdable) |
179 | -- |
180 | - !python {model: account.tax }: | |
181 | - vals = { |
182 | - 'ret': True, |
183 | - 'wh_vat_collected_account_id': ref("account.ova"), |
184 | - 'wh_vat_paid_account_id': ref("account.ova") |
185 | - } |
186 | - self.write(cr, uid, [ref("l10n_ve_fiscal_requirements.iva_purchase1")], vals) |
187 | |
188 | === removed file 'l10n_ve_withholding_iva/test/iva_purchase_nret1.yml' |
189 | --- l10n_ve_withholding_iva/test/iva_purchase_nret1.yml 2013-11-15 15:02:56 +0000 |
190 | +++ l10n_ve_withholding_iva/test/iva_purchase_nret1.yml 1970-01-01 00:00:00 +0000 |
191 | @@ -1,87 +0,0 @@ |
192 | -- |
193 | - 3. Iva tests purchase wh, wh should not be validated (test fails conditions) |
194 | -- |
195 | - 3.1 Check conditions for creating the document, first main company configuration |
196 | -- |
197 | - !assert {model: res.partner, id: base.main_company}: |
198 | - - wh_iva_agent |
199 | - - wh_iva_rate |
200 | - - vat_subjected |
201 | -- |
202 | - 3.2 Check partner configuration |
203 | -- |
204 | - !assert {model: res.partner, id: base.res_partner_23}: |
205 | - - wh_iva_agent |
206 | - - wh_iva_rate |
207 | - - vat_subjected |
208 | -- |
209 | - 3.3 Check IVA configuration |
210 | -- |
211 | - !assert {model: account.tax, id: iva_purchase0}: |
212 | - - amount |
213 | - - type_tax_use == 'purchase' |
214 | - - ret == False |
215 | - - not wh_vat_collected_account_id |
216 | - - not wh_vat_paid_account_id |
217 | -- |
218 | - 3.4 I create a purchase invoice |
219 | -- |
220 | - !record {model: account.invoice, id: test_purchase_iva_nret01}: |
221 | - type: out_invoice |
222 | - company_id: base.main_company |
223 | - date_invoice: !eval time.strftime('%Y-%m-%d') |
224 | - partner_id: base.res_partner_23 |
225 | - reference_type: none |
226 | - journal_id: account.expenses_journal |
227 | - wh_iva: True |
228 | - invoice_line: |
229 | - - product_id: product.product_product_3 |
230 | - quantity: 3 |
231 | - uos_id: product.product_uom_unit |
232 | - price_unit: 10 |
233 | - name: PC3 |
234 | - invoice_line_tax_id: |
235 | - - l10n_ve_fiscal_requirements.iva_purchase1 |
236 | - - product_id: product.product_product_4 |
237 | - quantity: 5 |
238 | - uos_id: product.product_uom_unit |
239 | - price_unit: 20 |
240 | - name: PC2 |
241 | - invoice_line_tax_id: |
242 | - - l10n_ve_fiscal_requirements.iva_purchase1 |
243 | -- |
244 | - 3.5 I check that Initially customer invoice is in the "Draft" state |
245 | -- |
246 | - !assert {model: account.invoice, id: test_purchase_iva_nret01}: |
247 | - - state == 'draft' |
248 | -- |
249 | - 3.6 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button |
250 | -- |
251 | - !workflow {model: account.invoice, action: invoice_proforma2, ref: test_purchase_iva_nret01} |
252 | -- |
253 | - 3.7 I check that the invoice state is now "Proforma2" |
254 | -- |
255 | - !assert {model: account.invoice, id: test_purchase_iva_nret01}: |
256 | - - state == 'proforma2' |
257 | -- |
258 | - 3.8 I create invoice by clicking on Create button |
259 | -- |
260 | - !workflow {model: account.invoice, action: invoice_open, ref: test_purchase_iva_nret01} |
261 | -- |
262 | - 3.9 I check that the invoice state is "Open" |
263 | -- |
264 | - !assert {model: account.invoice, id: test_purchase_iva_nret01, string: Invoice is not in open state}: |
265 | - - state == 'open' |
266 | -- |
267 | - 3.10 Set control number for the invoice |
268 | -- |
269 | - !python {model: account.invoice}: | |
270 | - self.write(cr, uid, [ref("test_purchase_iva_nret01")], {'nro_ctrl':'iva002', 'journal_id':ref("account.expenses_journal")}) |
271 | - ai_brw = self.browse(cr, uid, ref("test_purchase_iva_nret01")) |
272 | - assert ai_brw.nro_ctrl=='iva002' and ai_brw.journal_id.id == ref("account.expenses_journal"), 'Invoice wasn\'t updated properly' |
273 | -- |
274 | - 3.11 Check if withhold document was not created |
275 | -- |
276 | - !python {model: account.invoice}: | |
277 | - po = self.browse(cr, uid, ref("test_purchase_iva_nret01")) |
278 | - assert not po.wh_iva_id, 'Withholding document shouldn\'t be created' |
279 | |
280 | === removed file 'l10n_ve_withholding_iva/test/iva_purchase_nret2.yml' |
281 | --- l10n_ve_withholding_iva/test/iva_purchase_nret2.yml 2013-11-15 15:02:56 +0000 |
282 | +++ l10n_ve_withholding_iva/test/iva_purchase_nret2.yml 1970-01-01 00:00:00 +0000 |
283 | @@ -1,97 +0,0 @@ |
284 | -- |
285 | - 4. Iva tests purchase wh, wh should not be validated (test fails conditions) |
286 | -- |
287 | - 4.1 I update company information (not wh partner) |
288 | -- |
289 | - !python {model: res.partner}: | |
290 | - vals = { |
291 | - 'wh_iva_agent' : False, |
292 | - 'wh_iva_rate' : 0, |
293 | - 'vat_subjected' : False |
294 | - } |
295 | - self.write(cr, uid, ref("base.main_company"), vals) |
296 | -- |
297 | - 4.2 Check conditions for creating the document, first main company configuration |
298 | -- |
299 | - !assert {model: res.partner, id: base.main_company}: |
300 | - - not wh_iva_agent |
301 | - - wh_iva_rate == 0 |
302 | - - not vat_subjected |
303 | -- |
304 | - 4.3 Check partner configuration |
305 | -- |
306 | - !assert {model: res.partner, id: base.res_partner_23}: |
307 | - - wh_iva_agent |
308 | - - wh_iva_rate |
309 | - - vat_subjected |
310 | -- |
311 | - 4.4 Check IVA configuration |
312 | -- |
313 | - !assert {model: account.tax, id: l10n_ve_fiscal_requirements.iva_purchase1}: |
314 | - - amount |
315 | - - type_tax_use == 'purchase' |
316 | - - ret |
317 | - - wh_vat_collected_account_id |
318 | - - wh_vat_paid_account_id |
319 | -- |
320 | - 4.5 I create a purchase invoice |
321 | -- |
322 | - !record {model: account.invoice, id: test_purchase_iva_nret02}: |
323 | - type: out_invoice |
324 | - company_id: base.main_company |
325 | - date_invoice: !eval time.strftime('%Y-%m-%d') |
326 | - partner_id: base.res_partner_23 |
327 | - reference_type: none |
328 | - journal_id: account.expenses_journal |
329 | - wh_iva: True |
330 | - invoice_line: |
331 | - - product_id: product.product_product_3 |
332 | - quantity: 3 |
333 | - uos_id: product.product_uom_unit |
334 | - price_unit: 10 |
335 | - name: PC3 |
336 | - invoice_line_tax_id: |
337 | - - l10n_ve_fiscal_requirements.iva_purchase1 |
338 | - - product_id: product.product_product_4 |
339 | - quantity: 5 |
340 | - uos_id: product.product_uom_unit |
341 | - price_unit: 20 |
342 | - name: PC2 |
343 | - invoice_line_tax_id: |
344 | - - l10n_ve_fiscal_requirements.iva_purchase1 |
345 | -- |
346 | - 4.6 I check that Initially customer invoice is in the "Draft" state |
347 | -- |
348 | - !assert {model: account.invoice, id: test_purchase_iva_nret02}: |
349 | - - state == 'draft' |
350 | -- |
351 | - 4.7 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button |
352 | -- |
353 | - !workflow {model: account.invoice, action: invoice_proforma2, ref: test_purchase_iva_nret02} |
354 | -- |
355 | - 4.8 I check that the invoice state is now "Proforma2" |
356 | -- |
357 | - !assert {model: account.invoice, id: test_purchase_iva_nret02}: |
358 | - - state == 'proforma2' |
359 | -- |
360 | - 4.8 I create invoice by clicking on Create button |
361 | -- |
362 | - !workflow {model: account.invoice, action: invoice_open, ref: test_purchase_iva_nret02} |
363 | -- |
364 | - 4.10 I check that the invoice state is "Open" |
365 | -- |
366 | - !assert {model: account.invoice, id: test_purchase_iva_nret02, string: Invoice is not in open state}: |
367 | - - state == 'open' |
368 | -- |
369 | - 4.11 Set control number for the invoice |
370 | -- |
371 | - !python {model: account.invoice}: | |
372 | - self.write(cr, uid, [ref("test_purchase_iva_nret02")], {'nro_ctrl':'iva003', 'journal_id':ref("account.expenses_journal")}) |
373 | - ai_brw = self.browse(cr, uid, ref("test_purchase_iva_nret02")) |
374 | - assert ai_brw.nro_ctrl=='iva003' and ai_brw.journal_id.id == ref("account.expenses_journal"), 'Invoice wasn\'t updated properly' |
375 | -- |
376 | - 4.12 Check if withhold document was not created |
377 | -- |
378 | - !python {model: account.invoice}: | |
379 | - po = self.browse(cr, uid, ref("test_purchase_iva_nret02")) |
380 | - assert not po.wh_iva_id, 'Withholding document shouldn\'t be created' |
381 | |
382 | === removed file 'l10n_ve_withholding_iva/test/iva_purchase_nret3.yml' |
383 | --- l10n_ve_withholding_iva/test/iva_purchase_nret3.yml 2013-11-15 15:02:56 +0000 |
384 | +++ l10n_ve_withholding_iva/test/iva_purchase_nret3.yml 1970-01-01 00:00:00 +0000 |
385 | @@ -1,107 +0,0 @@ |
386 | -- |
387 | - 5. Iva tests purchase wh, wh should not be validated (test fails conditions) |
388 | -- |
389 | - 5.1 I update company information |
390 | -- |
391 | - !python {model: res.partner}: | |
392 | - vals = { |
393 | - 'wh_iva_agent' : True, |
394 | - 'wh_iva_rate' : 75, |
395 | - 'vat_subjected' : True |
396 | - } |
397 | - self.write(cr, uid, ref("base.main_company"), vals) |
398 | -- |
399 | - 5.2 Check conditions for creating the document, first main company configuration |
400 | -- |
401 | - !assert {model: res.partner, id: base.main_company}: |
402 | - - wh_iva_agent |
403 | - - wh_iva_rate |
404 | - - vat_subjected |
405 | -- |
406 | - 5.3 I update partner information |
407 | -- |
408 | - !python {model: res.partner}: | |
409 | - vals = { |
410 | - 'wh_iva_agent' : False, |
411 | - 'wh_iva_rate' : 0, |
412 | - 'vat_subjected' : False |
413 | - } |
414 | - self.write(cr, uid, ref("base.res_partner_23"), vals) |
415 | -- |
416 | - 5.4 Check partner configuration |
417 | -- |
418 | - !assert {model: res.partner, id: base.res_partner_23}: |
419 | - - not wh_iva_agent |
420 | - - wh_iva_rate == 0 |
421 | - - not vat_subjected |
422 | -- |
423 | - 5.5 Check IVA configuration |
424 | -- |
425 | - !assert {model: account.tax, id: l10n_ve_fiscal_requirements.iva_purchase1}: |
426 | - - amount |
427 | - - type_tax_use == 'purchase' |
428 | - - ret |
429 | - - wh_vat_collected_account_id |
430 | - - wh_vat_paid_account_id |
431 | -- |
432 | - 5.6 I create a purchase invoice |
433 | -- |
434 | - !record {model: account.invoice, id: test_purchase_iva_nret03}: |
435 | - type: out_invoice |
436 | - company_id: base.main_company |
437 | - date_invoice: !eval time.strftime('%Y-%m-%d') |
438 | - partner_id: base.res_partner_23 |
439 | - reference_type: none |
440 | - journal_id: account.expenses_journal |
441 | - wh_iva: True |
442 | - invoice_line: |
443 | - - product_id: product.product_product_3 |
444 | - quantity: 3 |
445 | - uos_id: product.product_uom_unit |
446 | - price_unit: 10 |
447 | - name: PC3 |
448 | - invoice_line_tax_id: |
449 | - - l10n_ve_fiscal_requirements.iva_purchase1 |
450 | - - product_id: product.product_product_4 |
451 | - quantity: 5 |
452 | - uos_id: product.product_uom_unit |
453 | - price_unit: 20 |
454 | - name: PC2 |
455 | - invoice_line_tax_id: |
456 | - - l10n_ve_fiscal_requirements.iva_purchase1 |
457 | -- |
458 | - 5.7 I check that Initially customer invoice is in the "Draft" state |
459 | -- |
460 | - !assert {model: account.invoice, id: test_purchase_iva_nret03}: |
461 | - - state == 'draft' |
462 | -- |
463 | - 5.8 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button |
464 | -- |
465 | - !workflow {model: account.invoice, action: invoice_proforma2, ref: test_purchase_iva_nret03} |
466 | -- |
467 | - 5.9 I check that the invoice state is now "Proforma2" |
468 | -- |
469 | - !assert {model: account.invoice, id: test_purchase_iva_nret03}: |
470 | - - state == 'proforma2' |
471 | -- |
472 | - 5.10 I create invoice by clicking on Create button |
473 | -- |
474 | - !workflow {model: account.invoice, action: invoice_open, ref: test_purchase_iva_nret03} |
475 | -- |
476 | - 5.11 I check that the invoice state is "Open" |
477 | -- |
478 | - !assert {model: account.invoice, id: test_purchase_iva_nret03, string: Invoice is not in open state}: |
479 | - - state == 'open' |
480 | -- |
481 | - 5.12 Set control number for the invoice |
482 | -- |
483 | - !python {model: account.invoice}: | |
484 | - self.write(cr, uid, [ref("test_purchase_iva_nret03")], {'nro_ctrl':'iva004', 'journal_id':ref("account.expenses_journal")}) |
485 | - ai_brw = self.browse(cr, uid, ref("test_purchase_iva_nret03")) |
486 | - assert ai_brw.nro_ctrl=='iva004' and ai_brw.journal_id.id == ref("account.expenses_journal"), 'Invoice wasn\'t updated properly' |
487 | -- |
488 | - 5.13 Check if withhold document was not created |
489 | -- |
490 | - !python {model: account.invoice}: | |
491 | - po = self.browse(cr, uid, ref("test_purchase_iva_nret03")) |
492 | - assert not po.wh_iva_id, 'Withholding document shouldn\'t be created' |
493 | |
494 | === removed file 'l10n_ve_withholding_iva/test/iva_purchase_wh.yml' |
495 | --- l10n_ve_withholding_iva/test/iva_purchase_wh.yml 2013-11-15 15:02:56 +0000 |
496 | +++ l10n_ve_withholding_iva/test/iva_purchase_wh.yml 1970-01-01 00:00:00 +0000 |
497 | @@ -1,92 +0,0 @@ |
498 | -- |
499 | - 2. Tests for iva purchase wh |
500 | -- |
501 | - 2.1 Check conditions for creating the document, first main company configuration |
502 | -- |
503 | - !assert {model: res.partner, id: base.main_company}: |
504 | - - wh_iva_agent |
505 | - - wh_iva_rate |
506 | - - vat_subjected |
507 | -- |
508 | - 2.2 Check partner configuration |
509 | -- |
510 | - !assert {model: res.partner, id: base.res_partner_23}: |
511 | - - wh_iva_agent |
512 | - - wh_iva_rate |
513 | - - vat_subjected |
514 | -- |
515 | - 2.3 Check IVA configuration |
516 | -- |
517 | - !assert {model: account.tax, id: l10n_ve_fiscal_requirements.iva_purchase1}: |
518 | - - amount |
519 | - - type_tax_use == 'purchase' |
520 | - - ret |
521 | - - wh_vat_collected_account_id |
522 | - - wh_vat_paid_account_id |
523 | -- |
524 | - 2.4 I create a purchase invoice |
525 | -- |
526 | - !record {model: account.invoice, id: test_purchase_iva02, view: account.invoice_supplier_form, context:{'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase'}}: |
527 | - type: in_invoice |
528 | - state: draft |
529 | - company_id: base.main_company |
530 | - date_invoice: !eval time.strftime('%Y-%m-%d') |
531 | - partner_id: base.res_partner_23 |
532 | - reference_type: none |
533 | - journal_id: |
534 | - wh_iva: True |
535 | - invoice_line: |
536 | - - product_id: product.product_product_3 |
537 | - quantity: 3 |
538 | - uos_id: product.product_uom_unit |
539 | - price_unit: 10 |
540 | - name: PC3 |
541 | - invoice_line_tax_id: |
542 | - - l10n_ve_fiscal_requirements.iva_purchase1 |
543 | - - product_id: product.product_product_4 |
544 | - quantity: 5 |
545 | - uos_id: product.product_uom_unit |
546 | - price_unit: 20 |
547 | - name: PC2 |
548 | - invoice_line_tax_id: |
549 | - - l10n_ve_fiscal_requirements.iva_purchase1 |
550 | -- |
551 | - 2.5 I check that Initially supplier invoice is in the "Draft" state |
552 | -- |
553 | - !python {model: account.invoice}: | |
554 | - ap_obj=self.pool.get('account.period') |
555 | - import time |
556 | - period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), context={'company_id':ref("base.main_company")}) |
557 | - assert period, 'There aren\'t periods for this date' |
558 | - ap_obj.write(cr, uid, period, {'special':False}) |
559 | - self.write(cr,uid,ref('test_purchase_iva02'),{'journal_id':ref('account.expenses_journal'),'type':'in_invoice'}) |
560 | - ai_brw = self.browse(cr,uid,ref('test_purchase_iva02')) |
561 | - assert ai_brw.type == 'in_invoice', "Not the intended type. It should be 'in_invoice' not '%s'"%ai_brw.type |
562 | - assert ai_brw.state == 'draft', "Not the intended state. It should be 'draft' not '%s'"%ai_brw.state |
563 | - assert ai_brw.journal_id.id == ref('account.expenses_journal'), "Not the intended Journal. It should be 'Expenses Journal - (test)' not '%s'"%ai_brw.journal_id.name |
564 | -- |
565 | - 2.6 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button |
566 | -- |
567 | - !workflow {model: account.invoice, action: invoice_proforma2, ref: test_purchase_iva02} |
568 | -- |
569 | - 2.7 I check that the invoice state is now "Proforma2" |
570 | -- |
571 | - !assert {model: account.invoice, id: test_purchase_iva02}: |
572 | - - state == 'proforma2' |
573 | -- |
574 | - 2.8 I create invoice by clicking on Create button |
575 | -- |
576 | - !workflow {model: account.invoice, action: invoice_open, ref: test_purchase_iva02} |
577 | -- |
578 | - 2.9 I check that the invoice state is "Open" |
579 | -- |
580 | - !assert {model: account.invoice, id: test_purchase_iva02, string: Invoice is not in open state}: |
581 | - - state == 'open' |
582 | -- |
583 | - 2.10 Set control number for the invoice |
584 | -- |
585 | - !python {model: account.invoice}: | |
586 | - self.write(cr, uid, [ref("test_purchase_iva02")], {'nro_ctrl':'iva002'}) |
587 | - ai_brw = self.browse(cr, uid, ref("test_purchase_iva02")) |
588 | - assert ai_brw.nro_ctrl=='iva002', "Not the intended Control Number. It should be 'iva002' not '%s'"%ai_brw.nro_ctrl |
589 | - assert ai_brw.journal_id.id == ref('account.expenses_journal'), "Not the intended Journal. It should be 'Expenses Journal - (test)' not '%s'"%ai_brw.journal_id.name |
590 | |
591 | === removed file 'l10n_ve_withholding_iva/test/iva_sale.yml' |
592 | --- l10n_ve_withholding_iva/test/iva_sale.yml 2013-01-15 14:31:52 +0000 |
593 | +++ l10n_ve_withholding_iva/test/iva_sale.yml 1970-01-01 00:00:00 +0000 |
594 | @@ -1,68 +0,0 @@ |
595 | -- |
596 | - 6. Iva tests sale wh |
597 | -- |
598 | - 6.1 I create IVA sale tax |
599 | -- |
600 | - !record {model: account.tax, id: iva_sale0}: |
601 | - name: 'IVA - Sale' |
602 | - amount: 0.12 |
603 | - type_tax_use: sale |
604 | - applicable_type: 'true' |
605 | - company_id: base.main_company |
606 | - ret: False |
607 | -- |
608 | - 6.2 Test if sale tax was properly created |
609 | -- |
610 | - !assert {model: account.tax, id: iva_purchase0}: |
611 | - - name |
612 | -- |
613 | - 6.3 I update partner information |
614 | -- |
615 | - !python {model: res.partner}: | |
616 | - vals = { |
617 | - 'wh_iva_agent': True, |
618 | - 'wh_iva_rate': 75, |
619 | - 'vat_subjected': True |
620 | - } |
621 | - self.write(cr, uid, ref('base.res_partner_23'), vals) |
622 | -- |
623 | - 6.4 Test if information was updated properly |
624 | -- |
625 | - !assert {model: res.partner, id: base.res_partner_23}: |
626 | - - wh_iva_agent |
627 | - - wh_iva_rate == 75 |
628 | - - vat_subjected |
629 | -- |
630 | - 6.5 I update company information |
631 | -- |
632 | - !python {model: res.partner}: | |
633 | - vals = { |
634 | - 'wh_iva_agent': True, |
635 | - 'wh_iva_rate': 75, |
636 | - 'vat_subjected': True |
637 | - } |
638 | - self.write(cr, uid, ref('base.main_company'), vals ) |
639 | -- |
640 | - 6.6 Test if company information was updated properly |
641 | -- |
642 | - !assert {model: res.partner, id: base.main_company}: |
643 | - - wh_iva_agent |
644 | - - wh_iva_rate == 75 |
645 | - - vat_subjected |
646 | -- |
647 | - 6.7 I create IVA sale tax (withholdable) |
648 | -- |
649 | - !record {model: account.tax, id: iva_sale1}: |
650 | - name: 'IVA - Sale (withholdable) 1' |
651 | - amount: 0.12 |
652 | - type_tax_use: sale |
653 | - applicable_type: 'true' |
654 | - company_id: base.main_company |
655 | - ret: True |
656 | - wh_vat_collected_account_id: account.ova |
657 | - wh_vat_paid_account_id: account.ova |
658 | -- |
659 | - 6.8 Test if tax was properly created |
660 | -- |
661 | - !assert {model: account.tax, id: iva_sale1}: |
662 | - - name |
663 | |
664 | === removed file 'l10n_ve_withholding_iva/test/iva_sale_2.yml' |
665 | --- l10n_ve_withholding_iva/test/iva_sale_2.yml 2012-05-10 20:09:06 +0000 |
666 | +++ l10n_ve_withholding_iva/test/iva_sale_2.yml 1970-01-01 00:00:00 +0000 |
667 | @@ -1,58 +0,0 @@ |
668 | -- |
669 | - I create IVA sale tax with wrong values amount > 1 for type = percent |
670 | -- |
671 | - !python {model: account.tax}: | |
672 | - vals = { |
673 | - 'name': 'Iva sale a', |
674 | - 'amount': 10.12, |
675 | - 'type_tax_use': 'sale', |
676 | - 'applicable_type': 'true', |
677 | - 'company_id': ref("base.main_company"), |
678 | - 'ret': False, |
679 | - 'type': 'percent' |
680 | - } |
681 | - try: |
682 | - at_id = self.create(cr, uid, vals) |
683 | - except Exception as e: |
684 | - at_id = -1 |
685 | - pass |
686 | - assert at_id == -1 or not at_id, 'Tax must not be saved because amount > 1 and type = percent' |
687 | -- |
688 | - I create IVA sale tax with wrong values amount < 0 for type = percent |
689 | -- |
690 | - !python {model: account.tax}: | |
691 | - vals = { |
692 | - 'name': 'Iva sale B', |
693 | - 'amount': -10.12, |
694 | - 'type_tax_use': 'sale', |
695 | - 'applicable_type': 'true', |
696 | - 'company_id': ref("base.main_company"), |
697 | - 'ret': False, |
698 | - 'type': 'percent' |
699 | - } |
700 | - try: |
701 | - at_id = self.create(cr, uid, vals) |
702 | - except Exception as e: |
703 | - at_id = -1 |
704 | - pass |
705 | - assert at_id == -1 or not at_id, 'Tax must not be saved because amount < 0 and type = percent' |
706 | -- |
707 | - I create IVA sale tax with wrong values Withholdeable but not tax accounts |
708 | -- |
709 | - !python {model: account.tax}: | |
710 | - vals = { |
711 | - 'name': 'Iva sale C', |
712 | - 'amount': 0.12, |
713 | - 'type_tax_use': 'sale', |
714 | - 'applicable_type': 'true', |
715 | - 'company_id': ref("base.main_company"), |
716 | - 'ret': True, |
717 | - 'type': 'percent' |
718 | - } |
719 | - at_id = -1 |
720 | - try: |
721 | - at_id = self.create(cr, uid, vals) |
722 | - except Exception as e: |
723 | - at_id = -1 |
724 | - pass |
725 | - assert at_id == -1 or not at_id, 'Tax must not be saved because has not accounts' |
726 | |
727 | === removed file 'l10n_ve_withholding_iva/test/iva_sale_wh.yml' |
728 | --- l10n_ve_withholding_iva/test/iva_sale_wh.yml 2013-11-15 15:02:56 +0000 |
729 | +++ l10n_ve_withholding_iva/test/iva_sale_wh.yml 1970-01-01 00:00:00 +0000 |
730 | @@ -1,205 +0,0 @@ |
731 | -- |
732 | - 7. Iva tests sale wh |
733 | -- |
734 | - 7.1 In order to test account invoice I create a new customer invoice |
735 | -- |
736 | - !record {model: account.invoice, id: test_sale_iva_ret01}: |
737 | - company_id: base.main_company |
738 | - currency_id: base.EUR |
739 | - date_invoice: !eval time.strftime('%Y-%m-%d') |
740 | - account_id: account.a_recv |
741 | - invoice_line: |
742 | - - product_id: product.product_product_3 |
743 | - quantity: 3 |
744 | - uos_id: product.product_uom_unit |
745 | - price_unit: 10 |
746 | - name: PC3 |
747 | - account_id: account.a_sale |
748 | - invoice_line_tax_id: |
749 | - - iva_sale1 |
750 | - - product_id: product.product_product_4 |
751 | - quantity: 5 |
752 | - uos_id: product.product_uom_unit |
753 | - price_unit: 20 |
754 | - name: PC2 |
755 | - account_id: account.a_sale |
756 | - invoice_line_tax_id: |
757 | - - iva_sale1 |
758 | - journal_id: account.sales_journal |
759 | - partner_id: base.res_partner_23 |
760 | - reference_type: none |
761 | -- |
762 | - 7.2 I check that Initially customer invoice is in the "Draft" state |
763 | -- |
764 | - !assert {model: account.invoice, id: test_sale_iva_ret01}: |
765 | - - state == 'draft' |
766 | -- |
767 | - 7.3 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button |
768 | -- |
769 | - !workflow {model: account.invoice, action: invoice_proforma2, ref: test_sale_iva_ret01} |
770 | -- |
771 | - 7.4 I check that the invoice state is now "Proforma2" |
772 | -- |
773 | - !assert {model: account.invoice, id: test_sale_iva_ret01}: |
774 | - - state == 'proforma2' |
775 | -- |
776 | - 7.5 I check that there is no move attached to the invoice |
777 | -- |
778 | - !python {model: account.invoice}: | |
779 | - acc_id=self.browse(cr, uid, ref("test_sale_iva_ret01")) |
780 | - assert (not acc_id.move_id), "Move falsely created at pro-forma" |
781 | -- |
782 | - 7.6 I create invoice by clicking on Create button |
783 | -- |
784 | - !workflow {model: account.invoice, action: invoice_open, ref: test_sale_iva_ret01} |
785 | -- |
786 | - 7.7 I check that the invoice state is "Open" |
787 | -- |
788 | - !assert {model: account.invoice, id: test_sale_iva_ret01}: |
789 | - - state == 'open' |
790 | -- |
791 | - 7.8 I check that now there is a move attached to the invoice |
792 | -- |
793 | - !python {model: account.invoice}: | |
794 | - acc_id=self.browse(cr, uid, ref("test_sale_iva_ret01")) |
795 | - assert acc_id.move_id, "Move not created for open invoice" |
796 | -- |
797 | - 7.9 I check journal entries for the invoice |
798 | -- |
799 | - !python {model: account.invoice}: | |
800 | - am_obj=self.pool.get('account.move') |
801 | - ai = self.browse(cr, uid, ref("test_sale_iva_ret01")) |
802 | - am_ids = am_obj.search(cr, uid, [('name', '=', ai.number)]) |
803 | - assert am_ids, 'Not found account move for the document' |
804 | - am_brw = am_obj.browse(cr, uid, am_ids[0]) |
805 | - d = c = 0 |
806 | - for l in am_brw.line_id: |
807 | - if l.account_id.id == ref("account.a_recv"): |
808 | - d += l.debit |
809 | - else: |
810 | - c += l.credit |
811 | - if l.tax_amount > 0: |
812 | - assert l.tax_amount == 15.6, 'Tax is wrong' |
813 | - assert c==d, 'Totals must match' |
814 | -- |
815 | - 7.10 I generate a withholding vat customer |
816 | -- |
817 | - !record {model: account.wh.iva, id: wh_iva_sale01}: |
818 | - journal_id: wh_sales_journal |
819 | - partner_id: base.res_partner_23 |
820 | - number: 111222333 |
821 | - account_id: account.a_recv |
822 | - name: 'IVA wh vat customer' |
823 | - type: out_invoice |
824 | -- |
825 | - 7.11 I check withholding vat customer |
826 | -- |
827 | - !assert {model: account.wh.iva, id: wh_iva_sale01}: |
828 | - - state == 'draft' |
829 | -- |
830 | - 7.12 I click on Calculate taxes button |
831 | -- |
832 | - !python {model: account.invoice}: | |
833 | - self.button_reset_taxes(cr, uid, [ref("test_sale_iva_ret01")]) |
834 | -- |
835 | - 7.13 Before validating let's add the period |
836 | -- |
837 | - !python {model: account.wh.iva}: | |
838 | - import time |
839 | - ap_obj=self.pool.get('account.period') |
840 | - period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), context={'company_id':ref("base.main_company")}) |
841 | - assert period, 'There aren\'t periods for this date' |
842 | - ap_obj.write(cr, uid, period, {'special':False}) |
843 | - ap_brw = ap_obj.browse(cr, uid, period[0]) |
844 | - if ap_brw.state == 'done': |
845 | - ap.action_draft(cr, uid, period) |
846 | - ap_brw = ap.browse(cr, uid, period[0]) |
847 | - assert ap_brw.state == 'draft', 'Period is not open as it should be' |
848 | - assert ap_brw.special == False, 'Period is special. It should be' |
849 | - |
850 | - self.write(cr, uid, ref("wh_iva_sale01"), {'period_id':period[0]}) |
851 | -- |
852 | - 7.14 I check period was modificated |
853 | -- |
854 | - !assert {model: account.wh.iva, id: wh_iva_sale01}: |
855 | - - period_id |
856 | -- |
857 | - 7.15 Check partner invoices |
858 | -- |
859 | - !python {model: account.wh.iva}: | |
860 | - wil_obj=self.pool.get('account.wh.iva.line') |
861 | - res = self.onchange_partner_id(cr, uid, [1], 'out_invoice', ref("base.res_partner_23")) |
862 | - ind_id = res['value']['wh_lines'][0]['invoice_id'] |
863 | - res['value']['wh_lines'][0].update({'retention_id': ref("wh_iva_sale01")}) |
864 | - wil_id = wil_obj.create(cr, uid, res['value']['wh_lines'][0]) |
865 | - wil_obj.load_taxes(cr, uid, [wil_id]) |
866 | -#~ - |
867 | - #~ 7.16 I try to confirm the withholding vat customer (This test raise an exception - is ok - but its commented to pursue next steps in the test) |
868 | -#~ - |
869 | - #~ !workflow {model: account.wh.iva, action: wh_iva_confirmed, ref: wh_iva_sale01} |
870 | -- |
871 | - 7.17 I check withholding vat not is confirmed because invoice has not control number |
872 | -- |
873 | - !assert {model: account.wh.iva, id: wh_iva_sale01, string: Vat document cannot be in confirmed state}: |
874 | - - state != 'confirmed' |
875 | -- |
876 | - 7.18 Create wizard for adding control number |
877 | -- |
878 | - !record {model: wiz.nroctrl, id: wizard_nro_ctrl}: |
879 | - name: '31010101' |
880 | - sure: True |
881 | -- |
882 | - 7.19 Execute wizard for control number |
883 | -- |
884 | - !python {model: wiz.nroctrl}: | |
885 | - import time |
886 | - ctx={} |
887 | - ctx.update({'lang': u'en_US', 'active_model': 'ir.ui.menu', 'tz': False, 'active_ids': [ref("test_sale_iva_ret01"),], 'active_id': ref("test_sale_iva_ret01")}) |
888 | - data_dict = {'name':time.strftime('%m/%Y'), 'sure': True, 'model': 'wh_p'} |
889 | - self.set_noctrl(cr, uid, [ref("wizard_nro_ctrl")], ctx) |
890 | -- |
891 | - 7.20 Check if control number was properly updated |
892 | -- |
893 | - !assert {model: account.invoice, id: test_sale_iva_ret01, string: Control number was not propely updated}: |
894 | - - nro_ctrl |
895 | -- |
896 | - 7.21 I confirm the withholding vat customer after updater control number |
897 | -- |
898 | - !workflow {model: account.wh.iva, action: wh_iva_confirmed, ref: wh_iva_sale01} |
899 | -- |
900 | - 7.22 I check withholding vat is confirmed |
901 | -- |
902 | - !assert {model: account.wh.iva, id: wh_iva_sale01, string: Wh documment eas not properly validated}: |
903 | - - state == 'confirmed' |
904 | -- |
905 | - 7.23 I mark it as done |
906 | -- |
907 | - !workflow {model: account.wh.iva, action: wh_iva_done, ref: wh_iva_sale01} |
908 | -- |
909 | - 7.24 I check withholding vat is done |
910 | -- |
911 | - !assert {model: account.wh.iva, id: wh_iva_sale01}: |
912 | - - state == 'done' |
913 | -- |
914 | - 7.25 I check that the invoice has the wh document |
915 | -- |
916 | - !assert {model: account.invoice, id: test_sale_iva_ret01}: |
917 | - - wh_iva_id |
918 | -- |
919 | - 7.26 I check IVA sale journal entries |
920 | -- |
921 | - !python {model: account.wh.iva}: | |
922 | - am_obj=self.pool.get('account.move') |
923 | - ai_obj=self.pool.get('account.invoice') |
924 | - acc_id=ai_obj.browse(cr, uid, ref("test_sale_iva_ret01")) |
925 | - am_ids = am_obj.search(cr, uid, [('ref', '=', acc_id.number)]) |
926 | - assert am_ids, 'Not found account move for the document' |
927 | - am_brw = am_obj.browse(cr, uid, am_ids[0]) |
928 | - assert len(am_brw.line_id) == 2, 'Must be 2 entries for this journal entry' |
929 | - d = c = 0 |
930 | - for l in am_brw.line_id: |
931 | - if l.account_id.id == ref("account.ova"): |
932 | - c += l.debit |
933 | - else: |
934 | - d += l.credit |
935 | - assert c==d, 'Totals must match' |
936 | |
937 | === removed file 'l10n_ve_withholding_iva/test/iva_sale_withholding.yml' |
938 | --- l10n_ve_withholding_iva/test/iva_sale_withholding.yml 2012-05-10 16:39:12 +0000 |
939 | +++ l10n_ve_withholding_iva/test/iva_sale_withholding.yml 1970-01-01 00:00:00 +0000 |
940 | @@ -1,58 +0,0 @@ |
941 | -- |
942 | - I create IVA sale tax with wrong values amount > 1 for type = percent |
943 | -- |
944 | - !python {model: account.tax}: | |
945 | - vals = { |
946 | - 'name': 'Iva sale a', |
947 | - 'amount': 10.12, |
948 | - 'type_tax_use': 'sale', |
949 | - 'applicable_type': 'true', |
950 | - 'company_id': ref("base.main_company"), |
951 | - 'ret': False, |
952 | - 'type': 'percent' |
953 | - } |
954 | - try: |
955 | - at_id = self.create(cr, uid, vals) |
956 | - except Exception as e: |
957 | - at_id = -1 |
958 | - pass |
959 | - assert at_id == -1 or not at_id, 'Tax must not be saved because amount > 1 and type = percent' |
960 | -- |
961 | - I create IVA sale tax with wrong values amount < 0 for type = percent |
962 | -- |
963 | - !python {model: account.tax}: | |
964 | - vals = { |
965 | - 'name': 'Iva sale B', |
966 | - 'amount': -10.12, |
967 | - 'type_tax_use': 'sale', |
968 | - 'applicable_type': 'true', |
969 | - 'company_id': ref("base.main_company"), |
970 | - 'ret': False, |
971 | - 'type': 'percent' |
972 | - } |
973 | - try: |
974 | - at_id = self.create(cr, uid, vals) |
975 | - except Exception as e: |
976 | - at_id = -1 |
977 | - pass |
978 | - assert at_id == -1 or not at_id, 'Tax must not be saved because amount < 0 and type = percent' |
979 | -- |
980 | - I create IVA sale tax with wrong values Withholdeable but not tax accounts |
981 | -- |
982 | - !python {model: account.tax}: | |
983 | - vals = { |
984 | - 'name': 'Iva sale C', |
985 | - 'amount': 0.12, |
986 | - 'type_tax_use': 'sale', |
987 | - 'applicable_type': 'true', |
988 | - 'company_id': ref("base.main_company"), |
989 | - 'ret': True, |
990 | - 'type': 'percent' |
991 | - } |
992 | - at_id = -1 |
993 | - try: |
994 | - at_id = self.create(cr, uid, vals) |
995 | - except Exception as e: |
996 | - at_id = -1 |
997 | - pass |
998 | - assert at_id == -1 or not at_id, 'Tax must not be saved because has not accounts' |
999 | |
1000 | === removed file 'l10n_ve_withholding_iva/test/iva_test_invoice.yml' |
1001 | --- l10n_ve_withholding_iva/test/iva_test_invoice.yml 2013-01-18 18:48:46 +0000 |
1002 | +++ l10n_ve_withholding_iva/test/iva_test_invoice.yml 1970-01-01 00:00:00 +0000 |
1003 | @@ -1,67 +0,0 @@ |
1004 | -- |
1005 | - 8. Test iva sale |
1006 | -- |
1007 | - 8.1 In order to test account invoice I create a new sale invoice with purchase tax |
1008 | -- |
1009 | - !record {model: account.invoice, id: test_iva01}: |
1010 | - company_id: base.main_company |
1011 | - currency_id: base.EUR |
1012 | - date_invoice: !eval time.strftime('%Y-%m-%d') |
1013 | - account_id: account.a_recv |
1014 | - invoice_line: |
1015 | - - product_id: product.product_product_3 |
1016 | - quantity: 3 |
1017 | - uos_id: product.product_uom_unit |
1018 | - price_unit: 10 |
1019 | - name: PC3 |
1020 | - account_id: account.a_sale |
1021 | - invoice_line_tax_id: |
1022 | - - iva_purchase0 |
1023 | - - product_id: product.product_product_4 |
1024 | - quantity: 5 |
1025 | - uos_id: product.product_uom_unit |
1026 | - price_unit: 20 |
1027 | - name: PC2 |
1028 | - account_id: account.a_sale |
1029 | - invoice_line_tax_id: |
1030 | - - iva_purchase0 |
1031 | - journal_id: account.sales_journal |
1032 | - partner_id: base.res_partner_23 |
1033 | - reference_type: none |
1034 | - nro_ctrl: 56778211 |
1035 | -- |
1036 | - 8.2 I check that Initially customer invoice is in the "Draft" state |
1037 | -- |
1038 | - !assert {model: account.invoice, id: test_iva01}: |
1039 | - - state == 'draft' |
1040 | -- |
1041 | - 8.3 I click on Calculate taxes button |
1042 | -- |
1043 | - !python {model: account.invoice}: | |
1044 | - acc_brw=self.browse(cr, uid, ref("test_iva01")) |
1045 | - self.button_reset_taxes(cr, uid, [ref("test_iva01")]) |
1046 | -- |
1047 | - 8.4 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button |
1048 | -- |
1049 | - !workflow {model: account.invoice, action: invoice_proforma2, ref: test_iva01} |
1050 | -- |
1051 | - 8.5 I check that the invoice state is now "Proforma2" |
1052 | -- |
1053 | - !assert {model: account.invoice, id: test_iva01}: |
1054 | - - state == 'proforma2' |
1055 | -- |
1056 | - 8.6 I check that there is no move attached to the invoice |
1057 | -- |
1058 | - !python {model: account.invoice}: | |
1059 | - acc_id=self.browse(cr, uid, ref("test_iva01")) |
1060 | - assert (not acc_id.move_id), "Move falsely created at pro-forma" |
1061 | -- |
1062 | - 8.7 I try to create an invoice by clicking on Create button |
1063 | -- |
1064 | - !workflow {model: account.invoice, action: invoice_open, ref: test_iva01} |
1065 | -#~ - |
1066 | - #~ 8.8 I check that the invoice state is not "Open" |
1067 | - # This test is failing. Is supposed to that "test_iva01" invoice remains in the proforma2 state, however it changes to open state |
1068 | -#~ - |
1069 | - #~ !assert {model: account.invoice, id: test_iva01, string: Sale invoice has purchase tax. The invoice cannot be in open state}: |
1070 | - #~ - state != 'open' |
1071 | |
1072 | === removed file 'l10n_ve_withholding_iva/test/iva_test_wh.yml' |
1073 | --- l10n_ve_withholding_iva/test/iva_test_wh.yml 2013-01-18 19:11:56 +0000 |
1074 | +++ l10n_ve_withholding_iva/test/iva_test_wh.yml 1970-01-01 00:00:00 +0000 |
1075 | @@ -1,57 +0,0 @@ |
1076 | -- |
1077 | - 9. Test withholdeable iva |
1078 | -- |
1079 | - 9.1 I update partner information |
1080 | -- |
1081 | - !record {model: res.partner, id: base.res_partner_23}: |
1082 | - wh_iva_agent: True |
1083 | - wh_iva_rate: 75 |
1084 | - vat_subjected: True |
1085 | -- |
1086 | - 9.2 I generate a withholding vat customer |
1087 | -- |
1088 | - !record {model: account.wh.iva, id: wh_iva_test01}: |
1089 | - journal_id: wh_sales_journal |
1090 | - partner_id: base.res_partner_23 |
1091 | - number: 55668811 |
1092 | - account_id: account.a_recv |
1093 | - name: 'IVA wh vat customer Vauxoo test' |
1094 | - type: out_invoice |
1095 | -- |
1096 | - 9.3 I check withholding vat customer |
1097 | -- |
1098 | - !assert {model: account.wh.iva, id: wh_iva_test01, string: Wh was not saved}: |
1099 | - - state == 'draft' |
1100 | -- |
1101 | - 9.4 Before validating let's add the period |
1102 | -- |
1103 | - !python {model: account.wh.iva}: | |
1104 | - import time |
1105 | - ap_obj=self.pool.get('account.period') |
1106 | - period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), {'company_id':ref('base.main_company')}) |
1107 | - assert period, 'There aren\'t periods for this date' |
1108 | - self.write(cr, uid, ref("wh_iva_test01"), {'period_id':period[0]}) |
1109 | -- |
1110 | - 9.5 I check period was updated |
1111 | -- |
1112 | - !assert {model: account.wh.iva, id: wh_iva_test01, string: Period was not updated}: |
1113 | - - period_id |
1114 | -#~ - |
1115 | - #~ 9.6 I confirm the withholding vat customer |
1116 | - #~ # This test case is commented because it raise the exception 'Invoices with Missing Withheld Taxes!' and interrupts the continuity of the other test cases |
1117 | -#~ - |
1118 | - #~ !workflow {model: account.wh.iva, action: wh_iva_confirmed, ref: wh_iva_test01} |
1119 | -- |
1120 | - 9.7 I check withholding vat is not confirmed |
1121 | -- |
1122 | - !assert {model: account.wh.iva, id: wh_iva_test01, string: Could not confirm the wh}: |
1123 | - - state != 'confirmed' |
1124 | -- |
1125 | - 9.8 I try to mark it as done |
1126 | -- |
1127 | - !workflow {model: account.wh.iva, action: wh_iva_done, ref: wh_iva_test01} |
1128 | -- |
1129 | - 9.9 I check withholding vat is not done |
1130 | -- |
1131 | - !assert {model: account.wh.iva, id: wh_iva_test01, string: Wh cannot be in done state}: |
1132 | - - state != 'done' |
1133 | |
1134 | === removed file 'l10n_ve_withholding_iva/test/iva_test_wh_2.yml' |
1135 | --- l10n_ve_withholding_iva/test/iva_test_wh_2.yml 2013-11-15 15:02:56 +0000 |
1136 | +++ l10n_ve_withholding_iva/test/iva_test_wh_2.yml 1970-01-01 00:00:00 +0000 |
1137 | @@ -1,70 +0,0 @@ |
1138 | -- |
1139 | - 10. Test not withholdeable iva |
1140 | -- |
1141 | - 10.1 I update partner information |
1142 | -- |
1143 | - !record {model: res.partner, id: base.res_partner_23}: |
1144 | - wh_iva_agent: True |
1145 | - wh_iva_rate: 75 |
1146 | - vat_subjected: True |
1147 | -- |
1148 | - 10.2 I generate a withholding vat customer |
1149 | -- |
1150 | - !record {model: account.wh.iva, id: wh_iva_test02, view: view_wh_iva_form_customer, context: {'type':'out_invoice'}}: |
1151 | - journal_id: wh_sales_journal |
1152 | - partner_id: base.res_partner_23 |
1153 | - number: 222444333000 |
1154 | - account_id: account.a_recv |
1155 | - name: 'IVA wh vat customer Vauxoo test 2' |
1156 | - type: out_invoice |
1157 | - state: draft |
1158 | -- |
1159 | - 10.3 I check withholding vat customer |
1160 | -- |
1161 | - !python {model: account.wh.iva}: | |
1162 | - values = {} |
1163 | - rp_obj = self.pool.get('res.partner') |
1164 | - rp_brw = rp_obj.browse(cr,uid,ref("base.res_partner_23")) |
1165 | - res = self.onchange_partner_id(cr, uid, [ref('wh_iva_test02')], 'out_invoice', rp_brw.id) |
1166 | - values['wh_lines'] = [(0,0,{'invoice_id':ref('test_iva01'), 'name':'N/A', 'wh_iva_rate':rp_brw.wh_iva_rate})] |
1167 | - values['account_id'] = res['value']['account_id'] |
1168 | - values['type'] = 'out_invoice' |
1169 | - self.write(cr,uid,ref('wh_iva_test02'),values) |
1170 | - awi_brw = self.browse(cr,uid,ref('wh_iva_test02')) |
1171 | - assert awi_brw.type == 'out_invoice', "Not the intended type. It should be 'out_invoice' not '%s'"%awi_brw.type |
1172 | - assert awi_brw.state == 'draft', "Not the intended state. It should be 'draft' not '%s'"%awi_brw.state |
1173 | - assert awi_brw.wh_lines, "There are no lines to withhold" |
1174 | - self.compute_amount_wh(cr,uid,[ref('wh_iva_test02')]) |
1175 | -- |
1176 | - 10.4 I confirm the withholding vat customer |
1177 | -- |
1178 | - !python {model: account.wh.iva}: | |
1179 | - import netsvc |
1180 | - from openerp.osv import osv |
1181 | - wf_service = netsvc.LocalService("workflow") |
1182 | - try: |
1183 | - self.check_wh_lines_fortnights(cr, uid, [ref('wh_iva_test02')]) |
1184 | - self.check_invoice_nro_ctrl(cr, uid, [ref('wh_iva_test02')]) |
1185 | - self.check_vat_wh(cr, uid, [ref('wh_iva_test02')]) |
1186 | - self.check_wh_taxes(cr, uid, [ref('wh_iva_test02')]) |
1187 | - self.check_wh_taxes(cr, uid, [ref('wh_iva_test02')]) |
1188 | - assert False, "An exception should have been raised, unwithholdable taxes are not allowed to reach here!" |
1189 | - except osv.except_osv: |
1190 | - # exception was raised as expected |
1191 | - pass |
1192 | -- |
1193 | - 10.5 I check withholding vat is not confirmed |
1194 | - # TODO: Check this test case, it fails. It means that something in the wh_iva_confirmed action is wrong. |
1195 | -- |
1196 | - !python {model: account.wh.iva}: | |
1197 | - awi_brw = self.browse(cr,uid,ref('wh_iva_test02')) |
1198 | - assert awi_brw.state == 'draft', "Not the intended state. It should be 'draft' not '%s'"%awi_brw.state |
1199 | -- |
1200 | - 10.6 I try to mark it as done |
1201 | -- |
1202 | - !workflow {model: account.wh.iva, action: wh_iva_done, ref: wh_iva_test01} |
1203 | -- |
1204 | - 10.7 I check withholding vat is not done |
1205 | -- |
1206 | - !assert {model: account.wh.iva, id: wh_iva_test01, string: Wh cannot be in done state}: |
1207 | - - state != 'done' |
1208 | |
1209 | === removed file 'l10n_ve_withholding_iva/test/iva_test_wh_3.yml' |
1210 | --- l10n_ve_withholding_iva/test/iva_test_wh_3.yml 2013-11-15 15:02:56 +0000 |
1211 | +++ l10n_ve_withholding_iva/test/iva_test_wh_3.yml 1970-01-01 00:00:00 +0000 |
1212 | @@ -1,62 +0,0 @@ |
1213 | -- |
1214 | - 11. Test not withholdeable iva |
1215 | -- |
1216 | - 11.1 I update partner information |
1217 | -- |
1218 | - !record {model: res.partner, id: base.res_partner_23}: |
1219 | - wh_iva_agent: True |
1220 | - wh_iva_rate: 75 |
1221 | - vat_subjected: True |
1222 | -- |
1223 | - 11.2 I generate a withholding vat customer |
1224 | -- |
1225 | - !record {model: account.wh.iva, id: wh_iva_test03}: |
1226 | - journal_id: wh_sales_journal |
1227 | - partner_id: base.res_partner_23 |
1228 | - account_id: account.a_recv |
1229 | - name: 'IVA wh vat customer Vauxoo test 3' |
1230 | - type: out_invoice |
1231 | - state: draft |
1232 | -- |
1233 | - 11.3 I check withholding vat customer |
1234 | -- |
1235 | - !python {model: account.wh.iva}: | |
1236 | - self.write(cr,uid,ref('wh_iva_test03'),{'type':'out_invoice'}) |
1237 | - awi_brw = self.browse(cr,uid,ref('wh_iva_test03')) |
1238 | - assert awi_brw.type == 'out_invoice', "Not the intended type. It should be 'out_invoice' not '%s'"%awi_brw.type |
1239 | - assert awi_brw.state == 'draft', "Not the intended state. It should be 'draft' not '%s'"%awi_brw.state |
1240 | -- |
1241 | - 11.4 Before validating let's add the period |
1242 | -- |
1243 | - !python {model: account.wh.iva}: | |
1244 | - import time |
1245 | - ap_obj=self.pool.get('account.period') |
1246 | - period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), {'company_id':ref('base.main_company')}) |
1247 | - assert period, 'There aren\'t periods for this date' |
1248 | - self.write(cr, uid, ref("wh_iva_test03"), {'period_id':period[0]}) |
1249 | -- |
1250 | - 11.5 I check period was updated |
1251 | -- |
1252 | - !assert {model: account.wh.iva, id: wh_iva_test01, string: Period was not updated}: |
1253 | - - period_id |
1254 | -- |
1255 | - 11.6 I confirm the withholding vat customer |
1256 | -- |
1257 | - !workflow {model: account.wh.iva, action: wh_iva_confirmed, ref: wh_iva_test03} |
1258 | -- |
1259 | - 11.7 I check withholding vat is not confirmed |
1260 | - # TODO: Check this test case, it fails. It means that something in the wh_iva_confirmed action is wrong. |
1261 | -- |
1262 | - !python {model: account.wh.iva}: | |
1263 | - awi_brw = self.browse(cr,uid,ref('wh_iva_test03')) |
1264 | - assert awi_brw.state == 'draft', "Not the intended state. It should be 'draft' not '%s'"%awi_brw.state |
1265 | -- |
1266 | - 11.8 I try to mark it as done |
1267 | -- |
1268 | - !workflow {model: account.wh.iva, action: wh_iva_done, ref: wh_iva_test01} |
1269 | -- |
1270 | - 11.9 I check withholding vat is not done |
1271 | -- |
1272 | - !python {model: account.wh.iva}: | |
1273 | - awi_brw = self.browse(cr,uid,ref('wh_iva_test03')) |
1274 | - assert awi_brw.state == 'draft', "Not the intended state. It should be 'draft' not '%s'"%awi_brw.state |
1275 | |
1276 | === removed file 'l10n_ve_withholding_iva/test/iva_test_wh_4.yml' |
1277 | --- l10n_ve_withholding_iva/test/iva_test_wh_4.yml 2013-11-15 15:02:56 +0000 |
1278 | +++ l10n_ve_withholding_iva/test/iva_test_wh_4.yml 1970-01-01 00:00:00 +0000 |
1279 | @@ -1,60 +0,0 @@ |
1280 | -- |
1281 | - 12. Test not withholdeable iva |
1282 | -- |
1283 | - 12.1 I update partner information |
1284 | -- |
1285 | - !record {model: res.partner, id: base.res_partner_23}: |
1286 | - wh_iva_agent: True |
1287 | - wh_iva_rate: 75 |
1288 | - vat_subjected: True |
1289 | -- |
1290 | - 12.2 I generate a withholding vat customer |
1291 | -- |
1292 | - !record {model: account.wh.iva, id: wh_iva_test04}: |
1293 | - journal_id: wh_sales_journal |
1294 | - partner_id: base.res_partner_23 |
1295 | - account_id: account.a_recv |
1296 | - name: 'IVA wh vat customer Vauxoo test 3' |
1297 | - type: out_invoice |
1298 | - state: draft |
1299 | -- |
1300 | - 12.3 I check withholding vat customer |
1301 | -- |
1302 | - !python {model: account.wh.iva}: | |
1303 | - self.write(cr,uid,ref('wh_iva_test04'),{'type':'out_invoice'}) |
1304 | - awi_brw = self.browse(cr,uid,ref('wh_iva_test04')) |
1305 | - assert awi_brw.type == 'out_invoice', "Not the intended type. It should be 'out_invoice' not '%s'"%awi_brw.type |
1306 | - assert awi_brw.state == 'draft', "Not the intended state. It should be 'draft' not '%s'"%awi_brw.state |
1307 | -- |
1308 | - 12.4 Before validating let's add the period |
1309 | -- |
1310 | - !python {model: account.wh.iva}: | |
1311 | - import time |
1312 | - ap_obj=self.pool.get('account.period') |
1313 | - period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), {'company_id':ref('base.main_company')}) |
1314 | - assert period, 'There aren\'t periods for this date' |
1315 | - self.write(cr, uid, ref("wh_iva_test04"), {'period_id':period[0], 'date':'2014/02/02'}) |
1316 | -- |
1317 | - 12.5 I check period was updated |
1318 | -- |
1319 | - !assert {model: account.wh.iva, id: wh_iva_test01, string: Period was not updated}: |
1320 | - - period_id |
1321 | -- |
1322 | - 12.6 I confirm the withholding vat customer |
1323 | -- |
1324 | - !workflow {model: account.wh.iva, action: wh_iva_confirmed, ref: wh_iva_test04} |
1325 | -- |
1326 | - 12.7 I check withholding vat is not confirmed |
1327 | - # TODO: Check this test case, it fails. It means that something in the wh_iva_confirmed action is wrong. |
1328 | -- |
1329 | - !assert {model: account.wh.iva, id: wh_iva_test04, string: Could not confirm the wh}: |
1330 | - - state != 'confirmed' |
1331 | -- |
1332 | - 12.8 I try to mark it as done |
1333 | -- |
1334 | - !workflow {model: account.wh.iva, action: wh_iva_done, ref: wh_iva_test01} |
1335 | -- |
1336 | - 12.9 I check withholding vat is not done |
1337 | -- |
1338 | - !assert {model: account.wh.iva, id: wh_iva_test01, string: Wh cannot be in done state}: |
1339 | - - state != 'done' |
1340 | |
1341 | === modified file 'l10n_ve_withholding_iva/test/purchase_invoice_wh_iva.yml' |
1342 | --- l10n_ve_withholding_iva/test/purchase_invoice_wh_iva.yml 2013-12-04 13:24:44 +0000 |
1343 | +++ l10n_ve_withholding_iva/test/purchase_invoice_wh_iva.yml 2013-12-10 15:12:11 +0000 |
1344 | @@ -39,6 +39,7 @@ |
1345 | - |
1346 | !record {model: account.invoice, id: purchase_invoice_ret_tax, view: account.invoice_supplier_form}: |
1347 | nro_ctrl: IVA RET AND NOT RET TAXES |
1348 | + supplier_invoice_number: IVA RET AND NOT RET TAXES |
1349 | partner_id: l10n_ve_fiscal_requirements.f_req_partner_1 |
1350 | account_id: account.a_pay |
1351 | company_id: base.main_company |
1352 | @@ -107,6 +108,7 @@ |
1353 | - |
1354 | !record {model: account.invoice, id: purchase_invoice_111, view: account.invoice_supplier_form}: &invoice |
1355 | nro_ctrl: 111-IVA |
1356 | + supplier_invoice_number: 111-IVA |
1357 | partner_id: l10n_ve_fiscal_requirements.f_req_partner_1 |
1358 | account_id: account.a_pay |
1359 | company_id: base.main_company |
1360 | @@ -143,6 +145,7 @@ |
1361 | - |
1362 | !record {model: account.invoice, id: purchase_invoice_110, view: account.invoice_supplier_form}: |
1363 | nro_ctrl: 110-IVA |
1364 | + supplier_invoice_number: 110-IVA |
1365 | invoice_line: |
1366 | - invoice_line_tax_id: |
1367 | - l10n_ve_fiscal_requirements.iva_purchase3 |
1368 | @@ -170,6 +173,7 @@ |
1369 | - |
1370 | !record {model: account.invoice, id: purchase_invoice_011, view: account.invoice_supplier_form}: |
1371 | nro_ctrl: 011-IVA |
1372 | + supplier_invoice_number: 011-IVA |
1373 | partner_id: l10n_ve_fiscal_requirements.f_req_partner_7 |
1374 | <<: *invoice |
1375 | - |
1376 | @@ -194,6 +198,7 @@ |
1377 | - |
1378 | !record {model: account.invoice, id: purchase_invoice_010, view: account.invoice_supplier_form}: |
1379 | nro_ctrl: 010-IVA |
1380 | + supplier_invoice_number: 010-IVA |
1381 | partner_id: l10n_ve_fiscal_requirements.f_req_partner_7 |
1382 | invoice_line: |
1383 | - invoice_line_tax_id: |
1384 | @@ -234,6 +239,7 @@ |
1385 | - |
1386 | !record {model: account.invoice, id: purchase_invoice_101, view: account.invoice_supplier_form}: |
1387 | nro_ctrl: 101-IVA |
1388 | + supplier_invoice_number: 101-IVA |
1389 | <<: *invoice |
1390 | - |
1391 | I change invoice to Open state. |
1392 | @@ -257,6 +263,7 @@ |
1393 | - |
1394 | !record {model: account.invoice, id: purchase_invoice_100, view: account.invoice_supplier_form}: |
1395 | nro_ctrl: 100-IVA |
1396 | + supplier_invoice_number: 100-IVA |
1397 | invoice_line: |
1398 | - invoice_line_tax_id: |
1399 | - l10n_ve_fiscal_requirements.iva_purchase3 |
1400 | @@ -284,6 +291,7 @@ |
1401 | - |
1402 | !record {model: account.invoice, id: purchase_invoice_001, view: account.invoice_supplier_form}: |
1403 | nro_ctrl: 001-IVA |
1404 | + supplier_invoice_number: 001-IVA |
1405 | partner_id: l10n_ve_fiscal_requirements.f_req_partner_7 |
1406 | <<: *invoice |
1407 | - |
1408 | @@ -308,6 +316,7 @@ |
1409 | - |
1410 | !record {model: account.invoice, id: purchase_invoice_000, view: account.invoice_supplier_form}: |
1411 | nro_ctrl: 000-IVA |
1412 | + supplier_invoice_number: 000-IVA |
1413 | partner_id: l10n_ve_fiscal_requirements.f_req_partner_7 |
1414 | invoice_line: |
1415 | - invoice_line_tax_id: |
1416 | @@ -336,6 +345,7 @@ |
1417 | - |
1418 | !record {model: account.invoice, id: purchase_invoice_00N, view: account.invoice_supplier_form}: |
1419 | nro_ctrl: 00N-IVA |
1420 | + supplier_invoice_number: 00N-IVA |
1421 | partner_id: l10n_ve_fiscal_requirements.f_req_partner_7 |
1422 | invoice_line: |
1423 | - product_id: product.product_product_4 |
1424 | @@ -366,6 +376,7 @@ |
1425 | - |
1426 | !record {model: account.invoice, id: purchase_invoice_01N, view: account.invoice_supplier_form}: |
1427 | nro_ctrl: 01N-IVA |
1428 | + supplier_invoice_number: 01N-IVA |
1429 | partner_id: l10n_ve_fiscal_requirements.f_req_partner_1 |
1430 | invoice_line: |
1431 | - product_id: product.product_product_4 |
1432 | |
1433 | === modified file 'l10n_ve_withholding_iva/test/purchase_wh_iva.yml' |
1434 | --- l10n_ve_withholding_iva/test/purchase_wh_iva.yml 2013-12-05 17:33:58 +0000 |
1435 | +++ l10n_ve_withholding_iva/test/purchase_wh_iva.yml 2013-12-10 15:12:11 +0000 |
1436 | @@ -34,6 +34,7 @@ |
1437 | - |
1438 | !record {model: account.invoice, id: wh_manual_purchase_awi_invoice}: &manual_purchase_awi_invoice |
1439 | nro_ctrl: AWI MANUAL PURCHASE INVOICE (WH COMPANY) |
1440 | + supplier_invoice_number: AWI MANUAL PURCHASE INVOICE (WH COMPANY) |
1441 | partner_id: l10n_ve_fiscal_requirements.f_req_partner_1 |
1442 | date_invoice: !eval time.strftime('%Y-%m-%d') |
1443 | company_id: base.main_company |
1444 | @@ -160,7 +161,56 @@ |
1445 | awi_brw = self.browse(cr, uid, awi_id) |
1446 | assert awi_brw.state == 'confirmed', 'The withholding document is not in confirmed state' |
1447 | - |
1448 | - 4.3 When the Company is not a withholding agent. |
1449 | + 4.3 When the withholding document have not withholding lines then it cannot |
1450 | + be confirm. |
1451 | +- |
1452 | + I create a supplier withholding document manually. |
1453 | +- |
1454 | + !record {model: account.wh.iva, id: supplier_no_lines_awi}: |
1455 | + name: AWI MANUAL NO WH LINES |
1456 | + <<: *whc_awi_manual_purchase |
1457 | +- |
1458 | + I check that the withholding document was correctly created. |
1459 | +- |
1460 | + !assert {model: account.wh.iva, id: supplier_no_lines_awi, string: The withholding document should be of purchase type (in_invoice) and should be in draft state.}: |
1461 | + - type == 'in_invoice' |
1462 | + - state == 'draft' |
1463 | +- |
1464 | + I search the current period and add it to the withholding doc. |
1465 | +- |
1466 | + !python {model: account.wh.iva}: | |
1467 | + import time |
1468 | + awi_id = ref( 'supplier_no_lines_awi' ) |
1469 | + company_id = ref('base.main_company') |
1470 | + period_obj = self.pool.get('account.period') |
1471 | + period = period_obj.find( |
1472 | + cr, uid, time.strftime('%Y/%m/%d'), {'company_id': company_id}) |
1473 | + assert period, 'There aren\'t periods for this date' |
1474 | + self.write(cr, uid, awi_id, {'period_id':period[0]}) |
1475 | +- |
1476 | + I compute the taxes manually with the button 'Compute Withholding Vat'. |
1477 | +- |
1478 | + !function {model: account.wh.iva, name: compute_amount_wh, id: supplier_no_lines_awi}: |
1479 | + - model: account.wh.iva |
1480 | + eval: "[ref('supplier_no_lines_awi')]" |
1481 | +- |
1482 | + I try to confirm the supplier withholding document. |
1483 | +- |
1484 | + !python {model: account.wh.iva}: | |
1485 | + awi_id = ref('supplier_no_lines_awi') |
1486 | + # Note: not use of workflow because it can not manage the exception. |
1487 | + try: |
1488 | + self.confirm_check(cr, uid, awi_id) |
1489 | + assert False, 'The withholding document can not be confirmed because has not wh lines associated.' |
1490 | + except Exception as e: |
1491 | + pass |
1492 | +- |
1493 | + I check that the withholding document remains in draft. |
1494 | +- |
1495 | + !assert {model: account.wh.iva, id: supplier_no_lines_awi, string: The withholding document can not be confirm because it haf no wh lines}: |
1496 | + - state == 'draft' |
1497 | +- |
1498 | + 4.4 When the Company is not a withholding agent. |
1499 | - |
1500 | I set company as a non-withholding agent. |
1501 | - |
1502 | @@ -176,6 +226,7 @@ |
1503 | - |
1504 | !record {model: account.invoice, id: nwh_manual_purchase_awi_invoice}: |
1505 | nro_ctrl: AWI MANUAL PURCHASE INVOICE (NON-WH COMPANY) |
1506 | + supplier_invoice_number: AWI MANUAL PURCHASE INVOICE (NON-WH COMPANY) |
1507 | <<: *manual_purchase_awi_invoice |
1508 | - |
1509 | I check that the invoice is of purchase type (in_invoice). |
1510 | |
1511 | === modified file 'l10n_ve_withholding_iva/test/purchase_wh_iva_sequence.yml' |
1512 | --- l10n_ve_withholding_iva/test/purchase_wh_iva_sequence.yml 2013-12-06 20:53:45 +0000 |
1513 | +++ l10n_ve_withholding_iva/test/purchase_wh_iva_sequence.yml 2013-12-10 15:12:11 +0000 |
1514 | @@ -60,6 +60,7 @@ |
1515 | - |
1516 | !record {model: account.invoice, id: supplier_seq_invoice_1, view: account.invoice_supplier_form}: &supplier_seq_invoice |
1517 | nro_ctrl: PURCHASE-IVA-SEQ-INVOICE-0001 |
1518 | + supplier_invoice_number: PURCHASE-IVA-SEQ-INVOICE-0001 |
1519 | partner_id: l10n_ve_fiscal_requirements.f_req_partner_1 |
1520 | account_id: account.a_pay |
1521 | company_id: base.main_company |
1522 | @@ -145,6 +146,7 @@ |
1523 | - |
1524 | !record {model: account.invoice, id: supplier_seq_invoice_2, view: account.invoice_supplier_form}: |
1525 | nro_ctrl: PURCHASE-IVA-SEQ-INVOICE-0002 |
1526 | + supplier_invoice_number: PURCHASE-IVA-SEQ-INVOICE-0002 |
1527 | << : *supplier_seq_invoice |
1528 | - |
1529 | I check the invoice type, state and have not wh doc. |
1530 | @@ -211,206 +213,413 @@ |
1531 | awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1532 | assert 'PURCHASE_TEST' in awi_brw.number, 'There was not used the supplier withholding sequence of the demo data. The sequence by type of withholding document is badly used.' |
1533 | assert '00001000' in awi_brw.number, 'The withholding documents are no creating consecutively' |
1534 | -- |
1535 | - 5.5 Using the supplier withholding generated in 5.4 I check if I cancel it |
1536 | - and then I re-used, the withholding number must remains and the sequence too. |
1537 | - I use two invoices. |
1538 | -- |
1539 | - I check that the last withholding sequence number was '0001000' |
1540 | -- |
1541 | - !python {model: account.invoice}: | |
1542 | - inv_id = ref( 'supplier_seq_invoice_2' ) |
1543 | - awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1544 | - assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
1545 | -- |
1546 | - I update the invoice and withholding journals to be able to cancel entries. |
1547 | -- |
1548 | - !python {model: account.invoice}: | |
1549 | - inv_id = ref( 'supplier_seq_invoice_2' ) |
1550 | - journal_obj = self.pool.get( 'account.journal' ) |
1551 | - inv_brw = self.browse(cr, uid, inv_id) |
1552 | - inv_journal_id = inv_brw.journal_id.id |
1553 | - wh_journal_id = inv_brw.wh_iva_id.journal_id.id |
1554 | - journal_obj.write( |
1555 | - cr, uid, [inv_journal_id, wh_journal_id], {'update_posted': True}) |
1556 | -- |
1557 | - I create a supplier invoice. |
1558 | -- |
1559 | - !record {model: account.invoice, id: supplier_seq_invoice_3, view: account.invoice_supplier_form}: |
1560 | - nro_ctrl: PURCHASE-IVA-SEQ-INVOICE-0003 |
1561 | - <<: *supplier_seq_invoice |
1562 | -- |
1563 | - I check the invoice type, state and have not wh doc. |
1564 | -- |
1565 | - !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The invoice was not correctly created. It need to be set in draft state, a supplier invoice type (in_invoice) and have not withholding document associaded.}: |
1566 | - - state == 'draft' |
1567 | - - type == 'in_invoice' |
1568 | - - not wh_iva_id |
1569 | -- |
1570 | - I confirm the invoice to create the withholding document. |
1571 | -- |
1572 | - !workflow {model: account.invoice, action: invoice_open, ref: supplier_seq_invoice_3} |
1573 | -- |
1574 | - I check that the invoice is confirmed and it generate a withholding doc. |
1575 | -- |
1576 | - !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The invoice was not correctly confirm. It need to change to open state (confirmed) and also generate and link a withholding document}: |
1577 | - - state == 'open' |
1578 | - - wh_iva_id |
1579 | -- |
1580 | - I confirm the withholding document |
1581 | -- |
1582 | - !python {model: account.invoice}: | |
1583 | - inv_id = ref( 'supplier_seq_invoice_3' ) |
1584 | - inv_brw = self.browse(cr, uid, inv_id) |
1585 | - awi_id = inv_brw.wh_iva_id.id |
1586 | - import netsvc |
1587 | - from openerp.osv import osv |
1588 | - wf_service = netsvc.LocalService( 'workflow' ) |
1589 | - wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_confirmed', cr) |
1590 | -- |
1591 | - I check the withholding is confirm and that the wh number is not set. |
1592 | -- |
1593 | - !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The withholding was not correctly confirm.}: |
1594 | - - wh_iva_id.state == 'confirmed' |
1595 | - - not wh_iva_id.number |
1596 | -- |
1597 | - I set the withholding to done state. |
1598 | -- |
1599 | - !python {model: account.invoice}: | |
1600 | - inv_id = ref( 'supplier_seq_invoice_3' ) |
1601 | - inv_brw = self.browse(cr, uid, inv_id) |
1602 | - awi_id = inv_brw.wh_iva_id.id |
1603 | - import netsvc |
1604 | - from openerp.osv import osv |
1605 | - wf_service = netsvc.LocalService( 'workflow' ) |
1606 | - wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_done', cr) |
1607 | -- |
1608 | - I check the withholding is done and that the wh number is set. |
1609 | -- |
1610 | - !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The withholding was not correctly done.}: |
1611 | - - wh_iva_id.state == 'done' |
1612 | - - wh_iva_id.number |
1613 | -- |
1614 | - I check if the withholding number use the sequence the consecutive number |
1615 | - 00001001. |
1616 | -- |
1617 | - !python {model: account.invoice}: | |
1618 | - inv_id = ref( 'supplier_seq_invoice_3' ) |
1619 | - awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1620 | - assert '00001001' in awi_brw.number, 'The withholding documents are no creating consecutively ' + awi_brw.number |
1621 | -- |
1622 | - I cancel the withholding document with sequence 00001001. |
1623 | -- |
1624 | - !python {model: account.invoice}: | |
1625 | - inv_id = ref( 'supplier_seq_invoice_3') |
1626 | - inv_brw = self.browse(cr, uid, inv_id) |
1627 | - awi_id = inv_brw.wh_iva_id.id |
1628 | - import netsvc |
1629 | - from openerp.osv import osv |
1630 | - wf_service = netsvc.LocalService( 'workflow' ) |
1631 | - wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'cancel', cr) |
1632 | - awi_obj = self.pool.get('account.wh.iva') |
1633 | - awi_brw = awi_obj.browse(cr, uid, awi_id) |
1634 | - assert awi_brw.state == 'cancel', 'It does not change the withholding state to cancel' |
1635 | -- |
1636 | - I cancel the withholding document with sequence 00001000, I set it to draft |
1637 | - and add two invoices. |
1638 | -- |
1639 | - !python {model: account.wh.iva}: | |
1640 | - import netsvc |
1641 | - from openerp.osv import osv |
1642 | - wf_service = netsvc.LocalService( 'workflow' ) |
1643 | - |
1644 | - invoice_ids = [ref( 'supplier_seq_invoice_2'), ref( 'supplier_seq_invoice_3' )] |
1645 | - awi_id = self.pool.get( 'account.invoice' ).browse( |
1646 | - cr, uid, invoice_ids[0]).wh_iva_id.id |
1647 | - wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'cancel', cr) |
1648 | - |
1649 | - awi_brw = self.browse(cr, uid, awi_id) |
1650 | - assert awi_brw.state == 'cancel', 'It does not change the withholding state to cancel' |
1651 | - assert not awi_brw.wh_lines, 'when a withholding document have been cancel then all its lines are clean' |
1652 | - wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'set_to_draft', cr) |
1653 | - |
1654 | - awi_brw = self.browse(cr, uid, awi_id) |
1655 | - assert awi_brw.state == 'draft', 'The withholding document was not reset to draft %s' % (awi_brw.state, ) |
1656 | - |
1657 | - values = {'wh_lines': []} |
1658 | - for invoice_id in invoice_ids: |
1659 | - res = self.onchange_partner_id( |
1660 | - cr, uid, [awi_id], 'out_invoice', awi_brw.partner_id.id) |
1661 | - values['wh_lines'] += [ |
1662 | - (0, 0, {'invoice_id': invoice_id, |
1663 | - 'name':'N/A', |
1664 | - 'wh_iva_rate': awi_brw.partner_id.wh_iva_rate})] |
1665 | - values['account_id'] = res['value']['account_id'] |
1666 | - self.write(cr, uid, awi_id, values) |
1667 | -- |
1668 | - I check that the withholding document sequence '00001000' state is draft and |
1669 | - that the two invoices was added, and also that the withholding number |
1670 | - remains. |
1671 | -- |
1672 | - !assert {model: account.invoice, id: supplier_seq_invoice_2, string: )}: |
1673 | - - wh_iva_id.state == 'draft' |
1674 | - - wh_iva_id.wh_lines |
1675 | - - wh_iva_id.number |
1676 | -- |
1677 | - I check that the re used withholding sequence number remains '0001000'. |
1678 | -- |
1679 | - !python {model: account.invoice}: | |
1680 | - inv_id = ref( 'supplier_seq_invoice_2' ) |
1681 | - awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1682 | - assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
1683 | -- |
1684 | - I compute the taxes manually with the button 'Compute Withholding Vat'. |
1685 | -- |
1686 | - !function {model: account.wh.iva, name: compute_amount_wh}: |
1687 | - - model: account.invoice |
1688 | - eval: "[obj(ref('supplier_seq_invoice_2')).wh_iva_id.id]" |
1689 | -- |
1690 | - I confirm the withholding document |
1691 | -- |
1692 | - !python {model: account.invoice}: | |
1693 | - inv_id = ref( 'supplier_seq_invoice_2' ) |
1694 | - inv_brw = self.browse(cr, uid, inv_id) |
1695 | - awi_id = inv_brw.wh_iva_id.id |
1696 | - import netsvc |
1697 | - from openerp.osv import osv |
1698 | - wf_service = netsvc.LocalService( 'workflow' ) |
1699 | - wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_confirmed', cr) |
1700 | -- |
1701 | - I check the withholding is confirm and that the wh number is set. |
1702 | -- |
1703 | - !assert {model: account.invoice, id: supplier_seq_invoice_2, string: The withholding was not correctly confirm.}: |
1704 | - - wh_iva_id.state == 'confirmed' |
1705 | - - wh_iva_id.number |
1706 | -- |
1707 | - I check that the re used withholding sequence number remains '0001000'. |
1708 | -- |
1709 | - !python {model: account.invoice}: | |
1710 | - inv_id = ref( 'supplier_seq_invoice_2' ) |
1711 | - awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1712 | - assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
1713 | -- |
1714 | - I set the withholding to done state. |
1715 | -- |
1716 | - !python {model: account.invoice}: | |
1717 | - inv_id = ref( 'supplier_seq_invoice_2' ) |
1718 | - inv_brw = self.browse(cr, uid, inv_id) |
1719 | - awi_id = inv_brw.wh_iva_id.id |
1720 | - import netsvc |
1721 | - from openerp.osv import osv |
1722 | - wf_service = netsvc.LocalService( 'workflow' ) |
1723 | - wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_done', cr) |
1724 | -- |
1725 | - I check the withholding is done and that the wh number is set. |
1726 | -- |
1727 | - !assert {model: account.invoice, id: supplier_seq_invoice_2, string: The withholding was not correctly done.}: |
1728 | - - wh_iva_id.state == 'done' |
1729 | - - wh_iva_id.number |
1730 | -- |
1731 | - I check that the re used withholding sequence number remains '0001000'. |
1732 | -- |
1733 | - !python {model: account.invoice}: | |
1734 | - inv_id = ref( 'supplier_seq_invoice_2' ) |
1735 | - awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1736 | - assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
1737 | +<<<<<<< TREE |
1738 | +- |
1739 | + 5.5 Using the supplier withholding generated in 5.4 I check if I cancel it |
1740 | + and then I re-used, the withholding number must remains and the sequence too. |
1741 | + I use two invoices. |
1742 | +- |
1743 | + I check that the last withholding sequence number was '0001000' |
1744 | +- |
1745 | + !python {model: account.invoice}: | |
1746 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
1747 | + awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1748 | + assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
1749 | +- |
1750 | + I update the invoice and withholding journals to be able to cancel entries. |
1751 | +- |
1752 | + !python {model: account.invoice}: | |
1753 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
1754 | + journal_obj = self.pool.get( 'account.journal' ) |
1755 | + inv_brw = self.browse(cr, uid, inv_id) |
1756 | + inv_journal_id = inv_brw.journal_id.id |
1757 | + wh_journal_id = inv_brw.wh_iva_id.journal_id.id |
1758 | + journal_obj.write( |
1759 | + cr, uid, [inv_journal_id, wh_journal_id], {'update_posted': True}) |
1760 | +- |
1761 | + I create a supplier invoice. |
1762 | +- |
1763 | + !record {model: account.invoice, id: supplier_seq_invoice_3, view: account.invoice_supplier_form}: |
1764 | + nro_ctrl: PURCHASE-IVA-SEQ-INVOICE-0003 |
1765 | + <<: *supplier_seq_invoice |
1766 | +- |
1767 | + I check the invoice type, state and have not wh doc. |
1768 | +- |
1769 | + !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The invoice was not correctly created. It need to be set in draft state, a supplier invoice type (in_invoice) and have not withholding document associaded.}: |
1770 | + - state == 'draft' |
1771 | + - type == 'in_invoice' |
1772 | + - not wh_iva_id |
1773 | +- |
1774 | + I confirm the invoice to create the withholding document. |
1775 | +- |
1776 | + !workflow {model: account.invoice, action: invoice_open, ref: supplier_seq_invoice_3} |
1777 | +- |
1778 | + I check that the invoice is confirmed and it generate a withholding doc. |
1779 | +- |
1780 | + !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The invoice was not correctly confirm. It need to change to open state (confirmed) and also generate and link a withholding document}: |
1781 | + - state == 'open' |
1782 | + - wh_iva_id |
1783 | +- |
1784 | + I confirm the withholding document |
1785 | +- |
1786 | + !python {model: account.invoice}: | |
1787 | + inv_id = ref( 'supplier_seq_invoice_3' ) |
1788 | + inv_brw = self.browse(cr, uid, inv_id) |
1789 | + awi_id = inv_brw.wh_iva_id.id |
1790 | + import netsvc |
1791 | + from openerp.osv import osv |
1792 | + wf_service = netsvc.LocalService( 'workflow' ) |
1793 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_confirmed', cr) |
1794 | +- |
1795 | + I check the withholding is confirm and that the wh number is not set. |
1796 | +- |
1797 | + !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The withholding was not correctly confirm.}: |
1798 | + - wh_iva_id.state == 'confirmed' |
1799 | + - not wh_iva_id.number |
1800 | +- |
1801 | + I set the withholding to done state. |
1802 | +- |
1803 | + !python {model: account.invoice}: | |
1804 | + inv_id = ref( 'supplier_seq_invoice_3' ) |
1805 | + inv_brw = self.browse(cr, uid, inv_id) |
1806 | + awi_id = inv_brw.wh_iva_id.id |
1807 | + import netsvc |
1808 | + from openerp.osv import osv |
1809 | + wf_service = netsvc.LocalService( 'workflow' ) |
1810 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_done', cr) |
1811 | +- |
1812 | + I check the withholding is done and that the wh number is set. |
1813 | +- |
1814 | + !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The withholding was not correctly done.}: |
1815 | + - wh_iva_id.state == 'done' |
1816 | + - wh_iva_id.number |
1817 | +- |
1818 | + I check if the withholding number use the sequence the consecutive number |
1819 | + 00001001. |
1820 | +- |
1821 | + !python {model: account.invoice}: | |
1822 | + inv_id = ref( 'supplier_seq_invoice_3' ) |
1823 | + awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1824 | + assert '00001001' in awi_brw.number, 'The withholding documents are no creating consecutively ' + awi_brw.number |
1825 | +- |
1826 | + I cancel the withholding document with sequence 00001001. |
1827 | +- |
1828 | + !python {model: account.invoice}: | |
1829 | + inv_id = ref( 'supplier_seq_invoice_3') |
1830 | + inv_brw = self.browse(cr, uid, inv_id) |
1831 | + awi_id = inv_brw.wh_iva_id.id |
1832 | + import netsvc |
1833 | + from openerp.osv import osv |
1834 | + wf_service = netsvc.LocalService( 'workflow' ) |
1835 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'cancel', cr) |
1836 | + awi_obj = self.pool.get('account.wh.iva') |
1837 | + awi_brw = awi_obj.browse(cr, uid, awi_id) |
1838 | + assert awi_brw.state == 'cancel', 'It does not change the withholding state to cancel' |
1839 | +- |
1840 | + I cancel the withholding document with sequence 00001000, I set it to draft |
1841 | + and add two invoices. |
1842 | +- |
1843 | + !python {model: account.wh.iva}: | |
1844 | + import netsvc |
1845 | + from openerp.osv import osv |
1846 | + wf_service = netsvc.LocalService( 'workflow' ) |
1847 | + |
1848 | + invoice_ids = [ref( 'supplier_seq_invoice_2'), ref( 'supplier_seq_invoice_3' )] |
1849 | + awi_id = self.pool.get( 'account.invoice' ).browse( |
1850 | + cr, uid, invoice_ids[0]).wh_iva_id.id |
1851 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'cancel', cr) |
1852 | + |
1853 | + awi_brw = self.browse(cr, uid, awi_id) |
1854 | + assert awi_brw.state == 'cancel', 'It does not change the withholding state to cancel' |
1855 | + assert not awi_brw.wh_lines, 'when a withholding document have been cancel then all its lines are clean' |
1856 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'set_to_draft', cr) |
1857 | + |
1858 | + awi_brw = self.browse(cr, uid, awi_id) |
1859 | + assert awi_brw.state == 'draft', 'The withholding document was not reset to draft %s' % (awi_brw.state, ) |
1860 | + |
1861 | + values = {'wh_lines': []} |
1862 | + for invoice_id in invoice_ids: |
1863 | + res = self.onchange_partner_id( |
1864 | + cr, uid, [awi_id], 'out_invoice', awi_brw.partner_id.id) |
1865 | + values['wh_lines'] += [ |
1866 | + (0, 0, {'invoice_id': invoice_id, |
1867 | + 'name':'N/A', |
1868 | + 'wh_iva_rate': awi_brw.partner_id.wh_iva_rate})] |
1869 | + values['account_id'] = res['value']['account_id'] |
1870 | + self.write(cr, uid, awi_id, values) |
1871 | +- |
1872 | + I check that the withholding document sequence '00001000' state is draft and |
1873 | + that the two invoices was added, and also that the withholding number |
1874 | + remains. |
1875 | +- |
1876 | + !assert {model: account.invoice, id: supplier_seq_invoice_2, string: )}: |
1877 | + - wh_iva_id.state == 'draft' |
1878 | + - wh_iva_id.wh_lines |
1879 | + - wh_iva_id.number |
1880 | +- |
1881 | + I check that the re used withholding sequence number remains '0001000'. |
1882 | +- |
1883 | + !python {model: account.invoice}: | |
1884 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
1885 | + awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1886 | + assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
1887 | +- |
1888 | + I compute the taxes manually with the button 'Compute Withholding Vat'. |
1889 | +- |
1890 | + !function {model: account.wh.iva, name: compute_amount_wh}: |
1891 | + - model: account.invoice |
1892 | + eval: "[obj(ref('supplier_seq_invoice_2')).wh_iva_id.id]" |
1893 | +- |
1894 | + I confirm the withholding document |
1895 | +- |
1896 | + !python {model: account.invoice}: | |
1897 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
1898 | + inv_brw = self.browse(cr, uid, inv_id) |
1899 | + awi_id = inv_brw.wh_iva_id.id |
1900 | + import netsvc |
1901 | + from openerp.osv import osv |
1902 | + wf_service = netsvc.LocalService( 'workflow' ) |
1903 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_confirmed', cr) |
1904 | +- |
1905 | + I check the withholding is confirm and that the wh number is set. |
1906 | +- |
1907 | + !assert {model: account.invoice, id: supplier_seq_invoice_2, string: The withholding was not correctly confirm.}: |
1908 | + - wh_iva_id.state == 'confirmed' |
1909 | + - wh_iva_id.number |
1910 | +- |
1911 | + I check that the re used withholding sequence number remains '0001000'. |
1912 | +- |
1913 | + !python {model: account.invoice}: | |
1914 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
1915 | + awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1916 | + assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
1917 | +- |
1918 | + I set the withholding to done state. |
1919 | +- |
1920 | + !python {model: account.invoice}: | |
1921 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
1922 | + inv_brw = self.browse(cr, uid, inv_id) |
1923 | + awi_id = inv_brw.wh_iva_id.id |
1924 | + import netsvc |
1925 | + from openerp.osv import osv |
1926 | + wf_service = netsvc.LocalService( 'workflow' ) |
1927 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_done', cr) |
1928 | +- |
1929 | + I check the withholding is done and that the wh number is set. |
1930 | +- |
1931 | + !assert {model: account.invoice, id: supplier_seq_invoice_2, string: The withholding was not correctly done.}: |
1932 | + - wh_iva_id.state == 'done' |
1933 | + - wh_iva_id.number |
1934 | +- |
1935 | + I check that the re used withholding sequence number remains '0001000'. |
1936 | +- |
1937 | + !python {model: account.invoice}: | |
1938 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
1939 | + awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1940 | + assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
1941 | +======= |
1942 | +- |
1943 | + 5.5 Using the supplier withholding generated in 5.4 I check if I cancel it |
1944 | + and then I re-used, the withholding number must remains and the sequence too. |
1945 | + I use two invoices. |
1946 | +- |
1947 | + I check that the last withholding sequence number was '0001000' |
1948 | +- |
1949 | + !python {model: account.invoice}: | |
1950 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
1951 | + awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
1952 | + assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
1953 | +- |
1954 | + I update the invoice and withholding journals to be able to cancel entries. |
1955 | +- |
1956 | + !python {model: account.invoice}: | |
1957 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
1958 | + journal_obj = self.pool.get( 'account.journal' ) |
1959 | + inv_brw = self.browse(cr, uid, inv_id) |
1960 | + inv_journal_id = inv_brw.journal_id.id |
1961 | + wh_journal_id = inv_brw.wh_iva_id.journal_id.id |
1962 | + journal_obj.write( |
1963 | + cr, uid, [inv_journal_id, wh_journal_id], {'update_posted': True}) |
1964 | +- |
1965 | + I create a supplier invoice. |
1966 | +- |
1967 | + !record {model: account.invoice, id: supplier_seq_invoice_3, view: account.invoice_supplier_form}: |
1968 | + nro_ctrl: PURCHASE-IVA-SEQ-INVOICE-0003 |
1969 | + supplier_invoice_number: PURCHASE-IVA-SEQ-INVOICE-0003 |
1970 | + <<: *supplier_seq_invoice |
1971 | +- |
1972 | + I check the invoice type, state and have not wh doc. |
1973 | +- |
1974 | + !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The invoice was not correctly created. It need to be set in draft state, a supplier invoice type (in_invoice) and have not withholding document associaded.}: |
1975 | + - state == 'draft' |
1976 | + - type == 'in_invoice' |
1977 | + - not wh_iva_id |
1978 | +- |
1979 | + I confirm the invoice to create the withholding document. |
1980 | +- |
1981 | + !workflow {model: account.invoice, action: invoice_open, ref: supplier_seq_invoice_3} |
1982 | +- |
1983 | + I check that the invoice is confirmed and it generate a withholding doc. |
1984 | +- |
1985 | + !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The invoice was not correctly confirm. It need to change to open state (confirmed) and also generate and link a withholding document}: |
1986 | + - state == 'open' |
1987 | + - wh_iva_id |
1988 | +- |
1989 | + I confirm the withholding document |
1990 | +- |
1991 | + !python {model: account.invoice}: | |
1992 | + inv_id = ref( 'supplier_seq_invoice_3' ) |
1993 | + inv_brw = self.browse(cr, uid, inv_id) |
1994 | + awi_id = inv_brw.wh_iva_id.id |
1995 | + import netsvc |
1996 | + from openerp.osv import osv |
1997 | + wf_service = netsvc.LocalService( 'workflow' ) |
1998 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_confirmed', cr) |
1999 | +- |
2000 | + I check the withholding is confirm and that the wh number is not set. |
2001 | +- |
2002 | + !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The withholding was not correctly confirm.}: |
2003 | + - wh_iva_id.state == 'confirmed' |
2004 | + - not wh_iva_id.number |
2005 | +- |
2006 | + I set the withholding to done state. |
2007 | +- |
2008 | + !python {model: account.invoice}: | |
2009 | + inv_id = ref( 'supplier_seq_invoice_3' ) |
2010 | + inv_brw = self.browse(cr, uid, inv_id) |
2011 | + awi_id = inv_brw.wh_iva_id.id |
2012 | + import netsvc |
2013 | + from openerp.osv import osv |
2014 | + wf_service = netsvc.LocalService( 'workflow' ) |
2015 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_done', cr) |
2016 | +- |
2017 | + I check the withholding is done and that the wh number is set. |
2018 | +- |
2019 | + !assert {model: account.invoice, id: supplier_seq_invoice_3, string: The withholding was not correctly done.}: |
2020 | + - wh_iva_id.state == 'done' |
2021 | + - wh_iva_id.number |
2022 | +- |
2023 | + I check if the withholding number use the sequence the consecutive number |
2024 | + 00001001. |
2025 | +- |
2026 | + !python {model: account.invoice}: | |
2027 | + inv_id = ref( 'supplier_seq_invoice_3' ) |
2028 | + awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
2029 | + assert '00001001' in awi_brw.number, 'The withholding documents are no creating consecutively ' + awi_brw.number |
2030 | +- |
2031 | + I cancel the withholding document with sequence 00001001. |
2032 | +- |
2033 | + !python {model: account.invoice}: | |
2034 | + inv_id = ref( 'supplier_seq_invoice_3') |
2035 | + inv_brw = self.browse(cr, uid, inv_id) |
2036 | + awi_id = inv_brw.wh_iva_id.id |
2037 | + import netsvc |
2038 | + from openerp.osv import osv |
2039 | + wf_service = netsvc.LocalService( 'workflow' ) |
2040 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'cancel', cr) |
2041 | + awi_obj = self.pool.get('account.wh.iva') |
2042 | + awi_brw = awi_obj.browse(cr, uid, awi_id) |
2043 | + assert awi_brw.state == 'cancel', 'It does not change the withholding state to cancel' |
2044 | +- |
2045 | + I cancel the withholding document with sequence 00001000, I set it to draft |
2046 | + and add two invoices. |
2047 | +- |
2048 | + !python {model: account.wh.iva}: | |
2049 | + import netsvc |
2050 | + from openerp.osv import osv |
2051 | + wf_service = netsvc.LocalService( 'workflow' ) |
2052 | + |
2053 | + invoice_ids = [ref( 'supplier_seq_invoice_2'), ref( 'supplier_seq_invoice_3' )] |
2054 | + awi_id = self.pool.get( 'account.invoice' ).browse( |
2055 | + cr, uid, invoice_ids[0]).wh_iva_id.id |
2056 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'cancel', cr) |
2057 | + |
2058 | + awi_brw = self.browse(cr, uid, awi_id) |
2059 | + assert awi_brw.state == 'cancel', 'It does not change the withholding state to cancel' |
2060 | + assert not awi_brw.wh_lines, 'when a withholding document have been cancel then all its lines are clean' |
2061 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'set_to_draft', cr) |
2062 | + |
2063 | + awi_brw = self.browse(cr, uid, awi_id) |
2064 | + assert awi_brw.state == 'draft', 'The withholding document was not reset to draft %s' % (awi_brw.state, ) |
2065 | + |
2066 | + values = {'wh_lines': []} |
2067 | + for invoice_id in invoice_ids: |
2068 | + res = self.onchange_partner_id( |
2069 | + cr, uid, [awi_id], 'out_invoice', awi_brw.partner_id.id) |
2070 | + values['wh_lines'] += [ |
2071 | + (0, 0, {'invoice_id': invoice_id, |
2072 | + 'name':'N/A', |
2073 | + 'wh_iva_rate': awi_brw.partner_id.wh_iva_rate})] |
2074 | + values['account_id'] = res['value']['account_id'] |
2075 | + self.write(cr, uid, awi_id, values) |
2076 | +- |
2077 | + I check that the withholding document sequence '00001000' state is draft and |
2078 | + that the two invoices was added, and also that the withholding number |
2079 | + remains. |
2080 | +- |
2081 | + !assert {model: account.invoice, id: supplier_seq_invoice_2, string: )}: |
2082 | + - wh_iva_id.state == 'draft' |
2083 | + - wh_iva_id.wh_lines |
2084 | + - wh_iva_id.number |
2085 | +- |
2086 | + I check that the re used withholding sequence number remains '0001000'. |
2087 | +- |
2088 | + !python {model: account.invoice}: | |
2089 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
2090 | + awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
2091 | + assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
2092 | +- |
2093 | + I compute the taxes manually with the button 'Compute Withholding Vat'. |
2094 | +- |
2095 | + !function {model: account.wh.iva, name: compute_amount_wh}: |
2096 | + - model: account.invoice |
2097 | + eval: "[obj(ref('supplier_seq_invoice_2')).wh_iva_id.id]" |
2098 | +- |
2099 | + I confirm the withholding document |
2100 | +- |
2101 | + !python {model: account.invoice}: | |
2102 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
2103 | + inv_brw = self.browse(cr, uid, inv_id) |
2104 | + awi_id = inv_brw.wh_iva_id.id |
2105 | + import netsvc |
2106 | + from openerp.osv import osv |
2107 | + wf_service = netsvc.LocalService( 'workflow' ) |
2108 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_confirmed', cr) |
2109 | +- |
2110 | + I check the withholding is confirm and that the wh number is set. |
2111 | +- |
2112 | + !assert {model: account.invoice, id: supplier_seq_invoice_2, string: The withholding was not correctly confirm.}: |
2113 | + - wh_iva_id.state == 'confirmed' |
2114 | + - wh_iva_id.number |
2115 | +- |
2116 | + I check that the re used withholding sequence number remains '0001000'. |
2117 | +- |
2118 | + !python {model: account.invoice}: | |
2119 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
2120 | + awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
2121 | + assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
2122 | +- |
2123 | + I set the withholding to done state. |
2124 | +- |
2125 | + !python {model: account.invoice}: | |
2126 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
2127 | + inv_brw = self.browse(cr, uid, inv_id) |
2128 | + awi_id = inv_brw.wh_iva_id.id |
2129 | + import netsvc |
2130 | + from openerp.osv import osv |
2131 | + wf_service = netsvc.LocalService( 'workflow' ) |
2132 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_done', cr) |
2133 | +- |
2134 | + I check the withholding is done and that the wh number is set. |
2135 | +- |
2136 | + !assert {model: account.invoice, id: supplier_seq_invoice_2, string: The withholding was not correctly done.}: |
2137 | + - wh_iva_id.state == 'done' |
2138 | + - wh_iva_id.number |
2139 | +- |
2140 | + I check that the re used withholding sequence number remains '0001000'. |
2141 | +- |
2142 | + !python {model: account.invoice}: | |
2143 | + inv_id = ref( 'supplier_seq_invoice_2' ) |
2144 | + awi_brw = self.browse(cr, uid, inv_id).wh_iva_id |
2145 | + assert '00001000' in awi_brw.number, 'The initial mark for this test is not correctly set, so it can continue' |
2146 | +>>>>>>> MERGE-SOURCE |
2147 | |
2148 | === added file 'l10n_ve_withholding_iva/test/purchase_wh_iva_txt.yml' |
2149 | --- l10n_ve_withholding_iva/test/purchase_wh_iva_txt.yml 1970-01-01 00:00:00 +0000 |
2150 | +++ l10n_ve_withholding_iva/test/purchase_wh_iva_txt.yml 2013-12-10 15:12:11 +0000 |
2151 | @@ -0,0 +1,300 @@ |
2152 | +- |
2153 | + 7. I make test over the txt docuemnts in purchase operations. |
2154 | +- |
2155 | + 7.1 I configure the enviroment. |
2156 | +- |
2157 | + I configure the context for purchase operations. |
2158 | +- |
2159 | + !context |
2160 | + 'type': 'in_invoice' |
2161 | +- |
2162 | + I set the company as a withholding agent (because is the only I can create a supplier withholdings). |
2163 | +- |
2164 | + !record {model: res.partner, id: base.main_partner}: |
2165 | + wh_iva_agent: True |
2166 | +- |
2167 | + I check that the company is withholding agent. |
2168 | +- |
2169 | + !assert {model: res.partner, id: base.main_partner, string: The Company is not a withholding agent}: |
2170 | + - wh_iva_agent |
2171 | +- |
2172 | + I check that the supplier that will be use exist. |
2173 | +- |
2174 | + !assert {model: res.partner, id: l10n_ve_fiscal_requirements.f_req_partner_1, string: The supplier used in this test exist}: |
2175 | + - id |
2176 | +- |
2177 | + I check that the tax that will be use is withholdeable. |
2178 | +- |
2179 | + !assert {model: account.tax, id: l10n_ve_fiscal_requirements.iva_purchase1, string: The tax is not withholdeable}: |
2180 | + - ret |
2181 | +- |
2182 | + I check that the account that will be use is payable type. |
2183 | +- |
2184 | + !assert {model: account.account, id: account.a_pay, string: The account is not of payable type}: |
2185 | + - type == 'payable' |
2186 | +- |
2187 | + 7.2 I check that txt document with no txt lines can not be confirm. |
2188 | +- |
2189 | + I create a txt document. |
2190 | +- |
2191 | + !record {model: txt.iva, id: supplier_txt_iva_1}: |
2192 | + #name: auto fll generic |
2193 | + #period: current. |
2194 | + date_start: !eval time.strftime('%Y-%m-%d') |
2195 | + date_end: !eval time.strftime('%Y-%m-%d') |
2196 | +- |
2197 | + I check that the txt document is in draft state with no txt lines. |
2198 | +- |
2199 | + !assert {model: txt.iva, id: supplier_txt_iva_1, string: the txt document was not correctly created}: |
2200 | + - state == 'draft' |
2201 | + - not txt_ids |
2202 | +- |
2203 | + I try to confirm the txt document with empty txt lines. |
2204 | +- |
2205 | + !python {model: txt.iva}: | |
2206 | + txt_id = ref( 'supplier_txt_iva_1' ) |
2207 | + try: |
2208 | + self.action_confirm(cr, uid, txt_id) |
2209 | + assert False, 'The txt document can be confirm when have empty txt lines.' |
2210 | + except Exception as e: |
2211 | + pass |
2212 | +- |
2213 | + I check that the txt document remains in draft state. |
2214 | +- |
2215 | + !assert {model: txt.iva, id: supplier_txt_iva_1, string: the txt document can not pass to confirm state}: |
2216 | + - state == 'draft' |
2217 | +- |
2218 | + 7.3 Using the txt document in 7.2 I check that only done withholding |
2219 | + documents can be add to a txt document. |
2220 | +- |
2221 | + I create a supplier invoice. |
2222 | +- |
2223 | + !record {model: account.invoice, id: supplier_txt_invoice_1, view: account.invoice_supplier_form}: &supplier_txt_invoice |
2224 | + nro_ctrl: PURCHASE-IVA-TXT-INVOICE-0001 |
2225 | + supplier_invoice_number: PURCHASE-IVA-TXT-INVOICE-0001 |
2226 | + partner_id: l10n_ve_fiscal_requirements.f_req_partner_1 |
2227 | + account_id: account.a_pay |
2228 | + company_id: base.main_company |
2229 | + currency_id: base.EUR |
2230 | + reference_type: none |
2231 | + invoice_line: |
2232 | + - product_id: product.product_product_4 |
2233 | + quantity: 3 |
2234 | + uos_id: product.product_uom_unit |
2235 | + price_unit: 3 |
2236 | + account_id: account.a_pay |
2237 | + invoice_line_tax_id: |
2238 | + - l10n_ve_fiscal_requirements.iva_purchase1 |
2239 | +- |
2240 | + I check the invoice type, state and have not wh doc. |
2241 | +- |
2242 | + !assert {model: account.invoice, id: supplier_txt_invoice_1, string: The invoice was not correctly created. It need to be set in draft state, a supplier invoice type (in_invoice) and have not withholding document associaded.}: |
2243 | + - state == 'draft' |
2244 | + - type == 'in_invoice' |
2245 | + - not wh_iva_id |
2246 | +- |
2247 | + I confirm the invoice to create the withholding document. |
2248 | +- |
2249 | + !workflow {model: account.invoice, action: invoice_open, ref: supplier_txt_invoice_1} |
2250 | +- |
2251 | + I check that the invoice is confirmed and it generate a withholding doc. |
2252 | +- |
2253 | + !assert {model: account.invoice, id: supplier_txt_invoice_1, string: The invoice was not correctly confirm. It need to change to open state (confirmed) and also generate and link a withholding document}: |
2254 | + - state == 'open' |
2255 | + - wh_iva_id |
2256 | +- |
2257 | + I check that the withholding document state is draft. |
2258 | +- |
2259 | + !assert {model: account.invoice, id: supplier_txt_invoice_1, string: When creating a supplier withholding via supplier invoice confirmation the state of the withholding document must be draft, and the wh number is unset (they will be set when the withholding is confirmed)}: |
2260 | + - wh_iva_id.state == 'draft' |
2261 | +- |
2262 | + I try to add the txt lines by pressing the 'Lines Generate TXT' button. |
2263 | +- |
2264 | + !function {model: txt.iva, name: action_generate_lines_txt, id: supplier_txt_iva_1}: |
2265 | + - model: txt.iva |
2266 | + eval: "[ref('supplier_txt_iva_1')]" |
2267 | +- |
2268 | + I check that only withholding documents in done state are added. |
2269 | +- |
2270 | + !python {model: txt.iva}: | |
2271 | + txt_id = ref( 'supplier_txt_iva_1' ) |
2272 | + txt_brw = self.browse(cr, uid, txt_id) |
2273 | + for txt_line_brw in txt_brw.txt_ids: |
2274 | + assert txt_line_brw.voucher_id.state == 'done', 'Error, only can add withholding documents in done state.' |
2275 | +- |
2276 | + I confirm the withholding document. |
2277 | +- |
2278 | + !python {model: account.invoice}: | |
2279 | + inv_id = ref( 'supplier_txt_invoice_1' ) |
2280 | + inv_brw = self.browse(cr, uid, inv_id) |
2281 | + awi_id = inv_brw.wh_iva_id.id |
2282 | + import netsvc |
2283 | + from openerp.osv import osv |
2284 | + wf_service = netsvc.LocalService( 'workflow' ) |
2285 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_confirmed', cr) |
2286 | +- |
2287 | + I check that the withholding document was confirm. |
2288 | +- |
2289 | + !assert {model: account.invoice, id: supplier_txt_invoice_1, string: The withholding document was not correctly confirm}: |
2290 | + - wh_iva_id.state == 'confirmed' |
2291 | +- |
2292 | + I try to add the txt lines by pressing the 'Lines Generate TXT' button. |
2293 | +- |
2294 | + !function {model: txt.iva, name: action_generate_lines_txt, id: supplier_txt_iva_1}: |
2295 | + - model: txt.iva |
2296 | + eval: "[ref('supplier_txt_iva_1')]" |
2297 | +- |
2298 | + I check that only withholding documents in done state are added. |
2299 | +- |
2300 | + !python {model: txt.iva}: | |
2301 | + txt_id = ref( 'supplier_txt_iva_1' ) |
2302 | + txt_brw = self.browse(cr, uid, txt_id) |
2303 | + for txt_line_brw in txt_brw.txt_ids: |
2304 | + assert txt_line_brw.voucher_id.state == 'done', 'Error, only can add withholding documents in done state.' |
2305 | +- |
2306 | + I change the withholding document to done. |
2307 | +- |
2308 | + !python {model: account.invoice}: | |
2309 | + inv_id = ref( 'supplier_txt_invoice_1' ) |
2310 | + inv_brw = self.browse(cr, uid, inv_id) |
2311 | + awi_id = inv_brw.wh_iva_id.id |
2312 | + import netsvc |
2313 | + from openerp.osv import osv |
2314 | + wf_service = netsvc.LocalService( 'workflow' ) |
2315 | + wf_service.trg_validate(uid, 'account.wh.iva', awi_id, 'wh_iva_done', cr) |
2316 | +- |
2317 | + I check that the withholding document was set to done. |
2318 | +- |
2319 | + !assert {model: account.invoice, id: supplier_txt_invoice_1, string: The withholding document was not correctly confirm}: |
2320 | + - wh_iva_id.state == 'done' |
2321 | +- |
2322 | + I try to add the txt lines by pressing the 'Lines Generate TXT' button. |
2323 | +- |
2324 | + !function {model: txt.iva, name: action_generate_lines_txt, id: supplier_txt_iva_1}: |
2325 | + - model: txt.iva |
2326 | + eval: "[ref('supplier_txt_iva_1')]" |
2327 | +- |
2328 | + I check that only withholding documents in done state are added. |
2329 | +- |
2330 | + !python {model: txt.iva}: | |
2331 | + txt_id = ref( 'supplier_txt_iva_1' ) |
2332 | + txt_brw = self.browse(cr, uid, txt_id) |
2333 | + for txt_line_brw in txt_brw.txt_ids: |
2334 | + assert txt_line_brw.voucher_id.state == 'done', 'Error, only can add withholding documents in done state.' |
2335 | +- |
2336 | + I check that the txt lines where added. |
2337 | +- |
2338 | + !assert {model: txt.iva, id: supplier_txt_iva_1, string: the txt lines were not added}: |
2339 | + - txt_ids |
2340 | +- |
2341 | + 7.4 I check that a withholding document can be cancel only when the txt |
2342 | + document associated are in draft state. |
2343 | +- |
2344 | + I check that the txt document is in draft state. |
2345 | +- |
2346 | + !assert {model: txt.iva, id: supplier_txt_iva_1, string: the txt document is not in draft state}: |
2347 | + - state == 'draft' |
2348 | +- |
2349 | + I confirm the txt document. |
2350 | +- |
2351 | + !function {model: txt.iva, name: action_confirm, ref: supplier_txt_iva_1}: |
2352 | + - model: txt.iva |
2353 | + eval: "[ref('supplier_txt_iva_1')]" |
2354 | +- |
2355 | + I check that the txt document is confirmed. |
2356 | +- |
2357 | + !assert {model: txt.iva, id: supplier_txt_iva_1, string: the txt document is not in confirmed state}: |
2358 | + - state == 'confirmed' |
2359 | +- |
2360 | + I update the invoice and withholding journals to be able to cancel entries. |
2361 | +- |
2362 | + !python {model: account.invoice}: | |
2363 | + inv_id = ref( 'supplier_txt_invoice_1' ) |
2364 | + journal_obj = self.pool.get( 'account.journal' ) |
2365 | + inv_brw = self.browse(cr, uid, inv_id) |
2366 | + inv_journal_id = inv_brw.journal_id.id |
2367 | + wh_journal_id = inv_brw.wh_iva_id.journal_id.id |
2368 | + journal_obj.write( |
2369 | + cr, uid, [inv_journal_id, wh_journal_id], {'update_posted': True}) |
2370 | +- |
2371 | + I try to cancel the withholding document. |
2372 | +- |
2373 | + !python {model: account.wh.iva}: | |
2374 | + inv_id = ref( 'supplier_txt_invoice_1') |
2375 | + inv_brw = self.pool.get('account.invoice').browse(cr, uid, inv_id) |
2376 | + awi_id = inv_brw.wh_iva_id.id |
2377 | + # Note: not use of workflow because it can not manage the exception. |
2378 | + try: |
2379 | + self.cancel_check(cr, uid, awi_id) |
2380 | + assert False, 'The withholding document can not change to cancel state. because has a txt document associated in confirmed state.' |
2381 | + |
2382 | + self.action_cancel(cr, uid, awi_id) |
2383 | + except Exception as e: |
2384 | + pass |
2385 | +- |
2386 | + I check that the wihholding document remains in done state. |
2387 | +- |
2388 | + !assert {model: account.invoice, id: supplier_txt_invoice_1, string: The withholding document can not be cancel}: |
2389 | + - wh_iva_id.state == 'done' |
2390 | +- |
2391 | + I change the txt document to done state. |
2392 | +- |
2393 | + !function {model: txt.iva, name: action_done, ref: supplier_txt_iva_1}: |
2394 | + - model: txt.iva |
2395 | + eval: "[ref('supplier_txt_iva_1')]" |
2396 | +- |
2397 | + I check that the txt document is in done state. |
2398 | +- |
2399 | + !assert {model: txt.iva, id: supplier_txt_iva_1, string: the txt document is not in confirmed state}: |
2400 | + - state == 'done' |
2401 | +- |
2402 | + I try to cancel the withholding document. |
2403 | +- |
2404 | + !python {model: account.wh.iva}: | |
2405 | + inv_id = ref( 'supplier_txt_invoice_1') |
2406 | + inv_brw = self.pool.get('account.invoice').browse(cr, uid, inv_id) |
2407 | + awi_id = inv_brw.wh_iva_id.id |
2408 | + # Note: not use of workflow because it can not manage the exception. |
2409 | + try: |
2410 | + self.cancel_check(cr, uid, awi_id) |
2411 | + assert False, 'The withholding document can not change to cancel state. because has a txt document associated with done state.' |
2412 | + self.action_cancel(cr, uid, awi_id) |
2413 | + except Exception as e: |
2414 | + pass |
2415 | +- |
2416 | + I check that the wihholding document remains in done state. |
2417 | +- |
2418 | + !assert {model: account.invoice, id: supplier_txt_invoice_1, string: The withholding document can not be cancel}: |
2419 | + - wh_iva_id.state == 'done' |
2420 | +- |
2421 | + I change the txt document to draft state. |
2422 | +- |
2423 | + !function {model: txt.iva, name: action_anular, ref: supplier_txt_iva_1}: |
2424 | + - model: txt.iva |
2425 | + eval: "[ref('supplier_txt_iva_1')]" |
2426 | +- |
2427 | + I check that the txt document is in draft state. |
2428 | +- |
2429 | + !assert {model: txt.iva, id: supplier_txt_iva_1, string: the txt document is not in draft state}: |
2430 | + - state == 'draft' |
2431 | +- |
2432 | + I try to cancel the withholding document. It change with no problems. |
2433 | +- |
2434 | + !python {model: account.wh.iva}: | |
2435 | + inv_id = ref( 'supplier_txt_invoice_1') |
2436 | + inv_brw = self.pool.get('account.invoice').browse(cr, uid, inv_id) |
2437 | + awi_id = inv_brw.wh_iva_id.id |
2438 | + # Note: not use of workflow because it can not manage the exception. |
2439 | + try: |
2440 | + self.cancel_check(cr, uid, awi_id) |
2441 | + self.action_cancel(cr, uid, [awi_id]) |
2442 | + assert self.browse(cr, uid, awi_id).state == 'cancel', 'The withholding document should change to cancel state.' |
2443 | + except Exception as e: |
2444 | + assert False, 'The withholding document can be change to cancel state and is not, so there is a problem in the code.' |
2445 | + |
2446 | +# To cancel a awi need to call: |
2447 | +# - from done state: cancel_check() |
2448 | +# - from the anothe states: nothing, only the signal 'cancel' to a signal 'cancel' |
2449 | +# Need execute this actions: |
2450 | +# action_cancel() |
2451 | +# write state to cancel |
2452 | |
2453 | === modified file 'l10n_ve_withholding_iva/test/sale_wh_iva.yml' |
2454 | --- l10n_ve_withholding_iva/test/sale_wh_iva.yml 2013-12-05 17:33:58 +0000 |
2455 | +++ l10n_ve_withholding_iva/test/sale_wh_iva.yml 2013-12-10 15:12:11 +0000 |
2456 | @@ -1087,3 +1087,51 @@ |
2457 | assert False, 'This can not happend. Only Open and Paid invoices can be added.' |
2458 | except Exception as e: |
2459 | pass |
2460 | +- |
2461 | + 3.9 I check that can not confirm a customer withholding with no wh lines. |
2462 | +- |
2463 | + I create a customer withholding document manually. |
2464 | +- |
2465 | + !record {model: account.wh.iva, id: customer_no_lines_awi, view: l10n_ve_withholding_iva.view_wh_iva_form_customer}: |
2466 | + name: MANUAL CUSTOMER AWI WITH NO WH LINES |
2467 | + <<: *awi_sale_011 |
2468 | +- |
2469 | + I check that the withholding document was correctly created. |
2470 | +- |
2471 | + !assert {model: account.wh.iva, id: customer_no_lines_awi, string: The withholding document should be of sale type (out_invoice) and should be in draft state.}: |
2472 | + - type == 'out_invoice' |
2473 | + - state == 'draft' |
2474 | +- |
2475 | + I search the current period and add it to the withholding doc. |
2476 | +- |
2477 | + !python {model: account.wh.iva}: | |
2478 | + import time |
2479 | + awi_id = ref( 'customer_no_lines_awi' ) |
2480 | + company_id = ref('base.main_company') |
2481 | + period_obj = self.pool.get('account.period') |
2482 | + period = period_obj.find( |
2483 | + cr, uid, time.strftime('%Y/%m/%d'), {'company_id': company_id}) |
2484 | + assert period, 'There aren\'t periods for this date' |
2485 | + self.write(cr, uid, awi_id, {'period_id':period[0]}) |
2486 | +- |
2487 | + I compute the taxes manually with the button 'Compute Withholding Vat'. |
2488 | +- |
2489 | + !function {model: account.wh.iva, name: compute_amount_wh, id: customer_no_lines_awi}: |
2490 | + - model: account.wh.iva |
2491 | + eval: "[ref('customer_no_lines_awi')]" |
2492 | +- |
2493 | + I try to confirm the supplier withholding document. |
2494 | +- |
2495 | + !python {model: account.wh.iva}: | |
2496 | + awi_id = ref('customer_no_lines_awi') |
2497 | + # Note: not use of workflow because it can not manage the exception. |
2498 | + try: |
2499 | + self.confirm_check(cr, uid, awi_id) |
2500 | + assert False, 'The withholding document can not be confirmed because has not wh lines associated.' |
2501 | + except Exception as e: |
2502 | + pass |
2503 | +- |
2504 | + I check that the withholding document remains in draft. |
2505 | +- |
2506 | + !assert {model: account.wh.iva, id: customer_no_lines_awi, string: The withholding document can not be confirm because it haf no wh lines}: |
2507 | + - state == 'draft' |