~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to account_journal/test/account_journal.yml

  • Committer: jf
  • Date: 2011-03-23 13:23:55 UTC
  • Revision ID: jf@tempo4-20110323132355-agyf1soy7m5ewatr
Initial Import

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
-
2
 
  I create a cash account type
3
 
-
4
 
  !record {model: account.account.type, id: account_account_type_cash_0}:
5
 
    close_method: balance
6
 
    code: cash
7
 
    name: Cash
8
 
    sign: 1
9
 
    report_type: asset
10
 
-
11
 
  I create a X11003 Cash Account.
12
 
-
13
 
  !record {model: account.account, id: account_account_cash0}:
14
 
    code: 'X11003-test'
15
 
    company_id: base.main_company
16
 
    currency_mode: current
17
 
    name: Cash (test)
18
 
    type: liquidity
19
 
    reconcile: False
20
 
    user_type : account_account_type_cash_0
21
 
    activation_date: !eval time.strftime('%Y-01-01')
22
 
-
23
 
  We create Timesheet journal for employee.
24
 
-
25
 
  !record {model: account.analytic.journal, id: analytic_journal_1}:
26
 
    code: CANJ
27
 
    name: Cash Analytic Journal
28
 
    type: general
29
 
-
30
 
  In order to check the Journal default value and register creation, we create a new cash journal.
31
 
-
32
 
  !record {model: account.journal, id: account_journal_1}:
33
 
    name: Cash Journal EUR
34
 
    code: CEUR
35
 
    currency: base.EUR
36
 
    type: cash
37
 
    analytic_journal_id: analytic_journal_1
38
 
    default_debit_account_id: account_account_cash0
39
 
    default_credit_account_id: account_account_cash0
40
 
-
41
 
  We check that the default parameters are correctly set
42
 
-
43
 
  !assert {model: account.journal, id: account_journal_1}:
44
 
    - allow_date == False
45
 
    - centralisation == False
46
 
    - entry_posted == False
47
 
    - update_posted == True
48
 
    - group_invoice_lines == False
49
 
-
50
 
  We check that the cash register was created
51
 
-
52
 
  !assert {model: account.bank.statement, search: "[('journal_id', '=', ref('account_journal.account_journal_1'))]"}:
53
 
    - name == 'Cash Journal EUR'
54
 
    - currency.id == ref("base.EUR")
55
 
-
56
 
  In order to test engagement journal, I create an invoice with the global_distrib_1 (75% for gabon, 25% for Kenya)
57
 
-
58
 
  !record {model: account.invoice, id: invoice_for_engagement_1}:
59
 
    account_id: account.a_pay
60
 
    address_contact_id: base.res_partner_address_3000
61
 
    address_invoice_id: base.res_partner_address_3000
62
 
    check_total: 250.0
63
 
    company_id: base.main_company
64
 
    currency_id: base.EUR
65
 
    journal_id: account.expenses_journal
66
 
    partner_id: base.res_partner_desertic_hispafuentes
67
 
    reference_type: none
68
 
    type: in_invoice
69
 
    analytic_distribution_id: global_distrib_1
70
 
    date_invoice: !eval time.strftime('%Y-%m-%d')
71
 
-
72
 
  Then I add an invoice line in order it takes analytic distribution from invoice
73
 
-
74
 
  !python {model: account.invoice.line}: |
75
 
    vals = {
76
 
        'account_id': ref('account_account_expense0'),
77
 
        'name': 'Product PC1',
78
 
        'price_unit': 50.0,
79
 
        'product_id': ref('product.product_product_pc1'),
80
 
        'quantity': 5.0,
81
 
        'uos_id': ref('product.product_uom_unit'),
82
 
        'invoice_id': ref('account_journal.invoice_for_engagement_1'),
83
 
    }
84
 
    self.create(cr, uid, vals)
85
 
-
86
 
  We validate the invoice
87
 
-
88
 
  !python {model: account.invoice}: |
89
 
    self.action_open_invoice(cr, uid, [ref('invoice_for_engagement_1')])
90
 
-
91
 
  I check that analytic lines where written for Gabon and Kenya in funding_pool elements.
92
 
-
93
 
  !python {model: account.analytic.line}: |
94
 
    # We should 2 lines for each analytic account with an amount of -187.5 and one of -62.5
95
 
    for el in [(187.50, ref('analytic_account_gabon')), (62.50, ref('analytic_account_kenya'))]:
96
 
        search_ids = self.search(cr, uid, [('amount', '=', -1 * el[0])])
97
 
        assert len(search_ids) == 1, "Some lines are missing."