~unifield-team/unifield-wm/us-927

« back to all changes in this revision

Viewing changes to msf_accrual/test/accrual_test.yml

  • Committer: Matthieu Dietrich
  • Date: 2012-03-07 11:26:19 UTC
  • mto: This revision was merged to the branch mainline in revision 675.
  • Revision ID: matthieu.dietrich@geneva.msf.org-20120307112619-ze1fu6cmfij8smhk
UF-820: [IMP] accrual management added

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-
 
2
  In order to test the financing contract,
 
3
  we need a lot.
 
4
  I create, in order, a account type, ...
 
5
-
 
6
  !record {model: account.account.type, id: account_account_type_expense0}:
 
7
    close_method: none
 
8
    code: expense
 
9
    name: Expense
 
10
    sign: 1
 
11
-
 
12
  !record {model: account.account.type, id: account_account_type_accrual0}:
 
13
    close_method: none
 
14
    code: accrual
 
15
    name: Accrual
 
16
    sign: 1
 
17
-
 
18
  ...an expense account, ...
 
19
-
 
20
  !record {model: account.account, id: test_expense}:
 
21
    name: "Test Expense"
 
22
    code: "TEST"
 
23
    user_type: account_account_type_expense0
 
24
    type: payable 
 
25
-
 
26
  ...an accrual account, ...
 
27
-
 
28
  !record {model: account.account, id: test_accrual}:
 
29
    name: "Test Accrual"
 
30
    code: "TEST2"
 
31
    user_type: account_account_type_accrual0
 
32
    type: payable 
 
33
    reconcile: True
 
34
-
 
35
 ...a cost center...
 
36
-
 
37
  !record {model: account.analytic.account, id: analytic_account_OC1}:
 
38
    name: "OC1"
 
39
    code: "OC1"
 
40
    category: OC
 
41
-
 
42
  ...an analytical journal, ...
 
43
-
 
44
  !record {model: account.analytic.journal, id: analytic_accrual_journal}:
 
45
    code: AC
 
46
    name: Accruals
 
47
    type: general
 
48
-
 
49
  ...a journal, ...
 
50
-
 
51
  !record {model: account.journal, id: accrual_journal}:
 
52
    name: Accruals
 
53
    code: AC
 
54
    type: accrual
 
55
    analytic_journal_id: analytic_accrual_journal
 
56
-
 
57
  I create an address
 
58
-
 
59
  !record {model: res.partner.address, id: res_partner_address_msf}:
 
60
    name: Médecins Sans Frontières
 
61
    street: 9 bis rue de Lyon
 
62
    zip: 01630
 
63
    city: Saint-Genis-Pouilly
 
64
    phone: +33 1 23 45 67 89
 
65
    email: essai@msf.org
 
66
-
 
67
 ...an employee...
 
68
-
 
69
  !record {model: hr.employee, id: employee_arthur_dent}:
 
70
    address_home_id: res_partner_address_msf
 
71
    company_id: base.main_company
 
72
    gender: male
 
73
    marital: hr.hr_employee_marital_status_single
 
74
    name: Arthur Dent
 
75
    user_id: base.user_root
 
76
-
 
77
  I set the company currency's rate to 1 for the move
 
78
-
 
79
  !record {model: res.currency.rate, id: currency_rate_test_3}:
 
80
    name: !eval "'%s-01-01' %(datetime.now().year+1)"
 
81
    rate: 1.00
 
82
    currency_id: base.CHF
 
83
-
 
84
  I set another currency's rate to 100 for the move
 
85
-
 
86
  !record {model: res.currency.rate, id: currency_rate_test_4}:
 
87
    name: !eval "'%s-01-01' %(datetime.now().year+1)"
 
88
    rate: 100.00
 
89
    currency_id: base.EUR
 
90
-
 
91
  ...a fiscal year, ...
 
92
-
 
93
  !record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}:
 
94
    code: !eval "'FY%s'% (datetime.now().year+1)"
 
95
    company_id: base.main_company
 
96
    date_start: !eval "'%s-01-01' %(datetime.now().year+1)"
 
97
    date_stop: !eval "'%s-12-31' %(datetime.now().year+1)"
 
98
    name: !eval "'Fiscal Year %s' %(datetime.now().year+1)"
 
99
-
 
100
  ... and a period.
 
101
-
 
102
  !record {model: account.period, id: account_period_mar0}:
 
103
    company_id: base.main_company
 
104
    date_start: !eval "'%s-03-01' %(datetime.now().year+1)"
 
105
    date_stop: !eval "'%s-03-31' %(datetime.now().year+1)"
 
106
    fiscalyear_id: account_fiscalyear_fiscalyear0
 
107
    name: !eval "'Mar %s' %(datetime.now().year+1)"
 
108
    special: 1
 
109
    state: draft
 
110
-
 
111
  ... and the next period.
 
112
-
 
113
  !record {model: account.period, id: account_period_apr0}:
 
114
    company_id: base.main_company
 
115
    date_start: !eval "'%s-04-01' %(datetime.now().year+1)"
 
116
    date_stop: !eval "'%s-04-30' %(datetime.now().year+1)"
 
117
    fiscalyear_id: account_fiscalyear_fiscalyear0
 
118
    name: !eval "'Apr %s' %(datetime.now().year+1)"
 
119
    special: 1
 
120
    state: draft
 
121
-
 
122
  ... and a distribution.
 
123
-
 
124
  !record {model: analytic.distribution, id: distribution_test}:
 
125
    cost_center_lines: 
 
126
    - analytic_id: analytic_account_OC1
 
127
      percentage: 100
 
128
      currency_id: base.CHF
 
129
      date: !eval "'%s-03-12' %(datetime.now().year+1)"
 
130
    funding_pool_lines:
 
131
    - analytic_id: analytic_distribution.analytic_account_msf_private_funds
 
132
      cost_center_id: analytic_account_OC1
 
133
      percentage: 100
 
134
      currency_id: base.CHF
 
135
      date: !eval "'%s-03-12' %(datetime.now().year+1)"
 
136
-
 
137
  I create an accrual line with all of this.
 
138
-
 
139
  !record {model: msf.accrual.line, id: accrual_line_test}:
 
140
    period_id: account_period_mar0
 
141
    expense_account_id: test_expense
 
142
    accrual_account_id: test_accrual
 
143
    description: 'test description'
 
144
    reference: 'test reference'
 
145
    currency_id: base.CHF
 
146
    date: !eval "'%s-03-12' %(datetime.now().year+1)"
 
147
    accrual_amount: 4242.0
 
148
    third_party_type: 'hr.employee'
 
149
    employee_id: employee_arthur_dent
 
150
    analytic_distribution_id: distribution_test
 
151
    state: draft
 
152
-
 
153
  Validate it
 
154
-
 
155
  !python {model: wizard.accrual.validation}: |
 
156
    self.button_confirm(cr, uid, [], context={'active_ids': [ref("accrual_line_test")] })
 
157
-
 
158
  Assert that line is posted
 
159
-
 
160
  !python {model: msf.accrual.line}: |
 
161
    accrual_line = self.browse(cr, uid, ref("accrual_line_test"), context={})
 
162
    assert accrual_line.state == 'posted', ("Line was not posted!")
 
163
    
 
 
b'\\ No newline at end of file'