~jo0thlt/sfsoluciones/mtf

« back to all changes in this revision

Viewing changes to account_voucher_tax/test/account_voucher_taxes_partial.yml

  • Committer: contact at zbeanztech
  • Date: 2014-11-07 18:54:14 UTC
  • Revision ID: contact@zbeanztech.com-20141107185414-tzybvn7293tju4ce
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-
 
2
  
 
3
-
 
4
-
 
5
  I create a supplier invoice
 
6
-
 
7
  !record {model: account.invoice, id: account_invoice_supplier_tax1}:
 
8
    account_id: account.a_pay
 
9
    check_total: 6182.80
 
10
    company_id: base.main_company
 
11
    currency_id: base.EUR
 
12
    invoice_line:
 
13
      - account_id: account.a_expense
 
14
        name: '[PC1] Basic PC'
 
15
        price_unit: 5330.0
 
16
        product_id: product.product_product_5
 
17
        quantity: 1.0
 
18
        invoice_line_tax_id:
 
19
                  - account_tax_iva
 
20
    journal_id: account.expenses_journal
 
21
    partner_id: base.res_partner_23
 
22
    reference_type: none
 
23
    type: in_invoice
 
24
 
 
25
-
 
26
  I change the state of invoice to open by clicking Validate button
 
27
-
 
28
  !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier_tax1}
 
29
-
 
30
  I check that the invoice state is now "Open"
 
31
-
 
32
  !assert {model: account.invoice, id: account_invoice_supplier_tax1}:
 
33
    - state == 'open'
 
34
 
 
35
-
 
36
  I create the first voucher of payment with values 3091.4
 
37
-
 
38
  !record {model: account.voucher, id: account_voucher_tax2, view: False}:
 
39
    company_id: base.main_company
 
40
    account_id: account.cash
 
41
    amount: 3091.4
 
42
    currency_id: base.EUR
 
43
    journal_id: account.bank_journal
 
44
    name: 'First Partial payment: with tax'
 
45
    partner_id: base.res_partner_23
 
46
    period_id: account.period_7
 
47
    date: !eval time.strftime("%Y-%m-%d")
 
48
    type: 'payment'
 
49
 
 
50
-
 
51
  Line of voucher
 
52
-
 
53
  !python {model: account.voucher}: |
 
54
    voucher_id = self.search(cr, uid, [('id', '=', ref('account_voucher_tax2'))])
 
55
    voucher = self.browse(cr, uid, voucher_id[0])
 
56
    res=self.onchange_journal(cr, uid, [voucher.id], journal_id=ref('account.bank_journal'), line_ids=[], tax_id=False, partner_id=voucher.partner_id.id, date=voucher.date, amount=3091.4, ttype='payment', company_id=voucher.company_id.id, context=None)
 
57
    onchange_journal_value=res.get('value', {}) or {}
 
58
    lines=onchange_journal_value.pop('line_dr_ids')[0]
 
59
    lines_format=[0,0]
 
60
    lines_format.append(lines)
 
61
    onchange_journal_value['line_dr_ids']=[tuple(lines_format)]
 
62
    self.write(cr,uid, [voucher.id], onchange_journal_value)
 
63
    assert (voucher.amount==3091.4) , "check amount"
 
64
-
 
65
  !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_tax2}
 
66
-
 
67
 
 
68
-
 
69
  I create the second voucher of payment with values 3091.4
 
70
-
 
71
  !record {model: account.voucher, id: account_voucher_tax3, view: False}:
 
72
    company_id: base.main_company
 
73
    account_id: account.cash
 
74
    currency_id: base.EUR
 
75
    amount: 3091.4
 
76
    journal_id: account.bank_journal
 
77
    name: 'Second Partial payment: with tax'
 
78
    partner_id: base.res_partner_c2c
 
79
    period_id: account.period_7
 
80
    date: !eval time.strftime("%Y-%m-%d")
 
81
    type: 'payment'
 
82
 
 
83
-
 
84
  Line of voucher
 
85
-
 
86
  !python {model: account.voucher}: |
 
87
    voucher_id = self.search(cr, uid, [('id', '=', ref('account_voucher_tax3'))])
 
88
    voucher = self.browse(cr, uid, voucher_id[0])
 
89
    res=self.onchange_journal(cr, uid, [voucher.id], journal_id=ref('account.bank_journal'), line_ids=[], tax_id=False, partner_id=voucher.partner_id.id, date=voucher.date, amount=3091.4, ttype='payment', company_id=voucher.company_id.id, context=None)
 
90
    onchange_journal_value=res.get('value', {}) or {}
 
91
    lines=onchange_journal_value.pop('line_dr_ids')[0]
 
92
    lines_format=[0,0]
 
93
    lines_format.append(lines)
 
94
    onchange_journal_value['line_dr_ids']=[tuple(lines_format)]
 
95
    self.write(cr,uid, [voucher.id], onchange_journal_value)
 
96
    assert (voucher.amount==3091.4) , "check amount"
 
97
-
 
98
  !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_tax3}
 
99
-