~openerp-venezuela/openerp-venezuela-localization/6.1

« back to all changes in this revision

Viewing changes to l10n_ve_withholding_islr/test/test_sale.yml

  • Committer: Tulio Ruiz
  • Date: 2012-09-28 23:14:43 UTC
  • mfrom: (746.1.3 ovl)
  • Revision ID: tulio@vauxoo.com-20120928231443-oguekagms2fke1gk
[MERGE] Basic tests for islr sale/purchase

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-
 
2
  2. Test a sale invoice
 
3
-
 
4
  2.1 I create a sale invoice
 
5
-
 
6
  !record {model: account.invoice, id: islr_inv02}:
 
7
    company_id: base.main_company
 
8
    currency_id: base.EUR
 
9
    date_invoice: !eval time.strftime('%Y-%m-%d')
 
10
    address_contact_id: base.res_partner_address_3
 
11
    address_invoice_id: base.res_partner_address_3
 
12
    account_id: account.a_recv
 
13
    invoice_line:
 
14
      - product_id: product.product_product_pc3
 
15
        quantity: 5
 
16
        uos_id: product.product_uom_unit
 
17
        price_unit: 1000
 
18
        name: islrprod01
 
19
        account_id: account.a_sale
 
20
        concept_id: islr_wh_concept_demo2
 
21
        invoice_line_tax_id:
 
22
        - account.tax10
 
23
      - product_id: product.product_product_pc4
 
24
        quantity: 5
 
25
        uos_id: product.product_uom_unit
 
26
        price_unit: 2000
 
27
        name: islrprod02
 
28
        concept_id: islr_wh_concept_demo2
 
29
        account_id: account.a_sale
 
30
        invoice_line_tax_id:
 
31
        - account.tax10
 
32
    journal_id: account.sales_journal
 
33
    partner_id: base.res_partner_notsotinysarl0
 
34
    nro_ctrl: islr456
 
35
    reference: isrlref456
 
36
    type: out_invoice
 
37
-
 
38
  2.2 I click on Calculate taxes button
 
39
-
 
40
  !python {model: account.invoice}: |
 
41
    acc_brw=self.browse(cr, uid, ref("islr_inv02"))
 
42
    self.button_reset_taxes(cr, uid, [ref("islr_inv02")])
 
43
-
 
44
  2.3 I update check total before validating the invoice
 
45
-
 
46
  !record {model: account.invoice, id: islr_inv02}:
 
47
    check_total: 16800.0
 
48
-
 
49
  2.4 I create invoice by clicking on Create button
 
50
-
 
51
  !workflow {model: account.invoice, action: invoice_open, ref: islr_inv02}
 
52
-
 
53
  2.5 I create wh document
 
54
-
 
55
  !python {model: islr.wh.doc}: |
 
56
    vals = self.onchange_partner_id(cr, uid, [], 'out_invoice', ref('base.res_partner_notsotinysarl0'))
 
57
    vals.update(
 
58
         { 'journal_id': ref('withholding_sale_journal'),
 
59
           'name': 'test islr sale',
 
60
           'currency_id': 1,
 
61
           'company_id': ref('base.main_company'),
 
62
           'account_id':ref('withholding_sale_journal'),
 
63
           'user_id':1,
 
64
           'partner_id': ref('base.res_partner_notsotinysarl0'),
 
65
           'type': 'out_invoice',
 
66
            })
 
67
    res = self.create(cr, uid, vals)
 
68
    assert res, "Wh documents was not created"
 
69
    ai_obj = self.pool.get('account.invoice')
 
70
    ai_obj.write(cr, uid, [ref('islr_inv02')], {'islr_wh_doc_id': res})
 
71
-
 
72
  2.6 check if wh document was asociated wth the invoice (it must be))
 
73
-
 
74
  !assert {model: account.invoice, id: islr_inv02}:
 
75
    - islr_wh_doc_id.id
 
76
-
 
77
  2.7 I create validate wh document clicking the Progress button
 
78
-
 
79
  !python {model: account.invoice}: |
 
80
    import netsvc
 
81
    ai_brw = self.browse(cr, uid, ref('islr_inv02'))
 
82
    wf = netsvc.LocalService("workflow")
 
83
    wf.trg_validate(uid, 'islr.wh.doc', ai_brw.islr_wh_doc_id.id, 'act_progress', cr)
 
84
-
 
85
  2.8 Search for the wh lines
 
86
-
 
87
  !python {model: account.invoice}: |
 
88
    import netsvc
 
89
    import time
 
90
    ai_brw = self.browse(cr, uid, ref("islr_inv02"))
 
91
    assert ai_brw.islr_wh_doc_id.amount_total_ret == 750.0, "Bad value for retention amount"