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

« back to all changes in this revision

Viewing changes to account_journal/test/account_journal.yml

UF-663: [IMP] first version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
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
2
  We create Timesheet journal for employee.
24
3
-
25
4
  !record {model: account.analytic.journal, id: analytic_journal_1}:
26
5
    code: CANJ
27
6
    name: Cash Analytic Journal
28
7
    type: general
 
8
 
29
9
-
30
10
  In order to check the Journal default value and register creation, we create a new cash journal.
31
11
-
32
12
  !record {model: account.journal, id: account_journal_1}:
33
 
    name: Cash Journal EUR
 
13
    name: Cash Journal
34
14
    code: CEUR
35
15
    currency: base.EUR
36
16
    type: cash
37
17
    analytic_journal_id: analytic_journal_1
38
 
    default_debit_account_id: account_account_cash0
39
 
    default_credit_account_id: account_account_cash0
 
18
    
40
19
-
41
20
  We check that the default parameters are correctly set
42
21
-
46
25
    - entry_posted == False
47
26
    - update_posted == True
48
27
    - group_invoice_lines == False
 
28
    
49
29
-
50
30
  We check that the cash register was created
51
31
-
52
32
  !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 datetime.today().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.a_expense'),
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 cost_center and 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]), ('account_id', '=', el[1])])
97
 
        assert len(search_ids) == 2, "Some lines are missing."
 
33
    - name == 'REG1CEUR'
 
34
    - currency.id == ref("base.EUR")
 
 
b'\\ No newline at end of file'