2
In order to test the financing contract,
4
I create, in order, a account type, ...
6
!record {model: account.account.type, id: account_account_type_expense0}:
12
!record {model: account.account.type, id: account_account_type_accrual0}:
18
...an expense account, ...
20
!record {model: account.account, id: test_expense}:
23
user_type: account_account_type_expense0
26
...an accrual account, ...
28
!record {model: account.account, id: test_accrual}:
31
user_type: account_account_type_accrual0
37
!record {model: account.analytic.account, id: analytic_account_OC1}:
42
...an analytical journal, ...
44
!record {model: account.analytic.journal, id: analytic_accrual_journal}:
51
!record {model: account.journal, id: accrual_journal}:
55
analytic_journal_id: analytic_accrual_journal
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
63
city: Saint-Genis-Pouilly
64
phone: +33 1 23 45 67 89
69
!record {model: hr.employee, id: employee_arthur_dent}:
70
address_home_id: res_partner_address_msf
71
company_id: base.main_company
73
marital: hr.hr_employee_marital_status_single
75
user_id: base.user_root
77
I set the company currency's rate to 1 for the move
79
!record {model: res.currency.rate, id: currency_rate_test_3}:
80
name: !eval "'%s-01-01' %(datetime.now().year+1)"
84
I set another currency's rate to 100 for the move
86
!record {model: res.currency.rate, id: currency_rate_test_4}:
87
name: !eval "'%s-01-01' %(datetime.now().year+1)"
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)"
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)"
111
... and the next period.
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)"
122
... and a distribution.
124
!record {model: analytic.distribution, id: distribution_test}:
126
- analytic_id: analytic_account_OC1
128
currency_id: base.CHF
129
date: !eval "'%s-03-12' %(datetime.now().year+1)"
131
- analytic_id: analytic_distribution.analytic_account_msf_private_funds
132
cost_center_id: analytic_account_OC1
134
currency_id: base.CHF
135
date: !eval "'%s-03-12' %(datetime.now().year+1)"
137
I create an accrual line with all of this.
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
document_date: !eval "'%s-03-12' %(datetime.now().year+1)"
148
accrual_amount: 4242.0
149
third_party_type: 'hr.employee'
150
employee_id: employee_arthur_dent
151
analytic_distribution_id: distribution_test
156
!python {model: wizard.accrual.validation}: |
157
self.button_confirm(cr, uid, [], context={'active_ids': [ref("accrual_line_test")] })
159
Assert that line is posted
161
!python {model: msf.accrual.line}: |
162
accrual_line = self.browse(cr, uid, ref("accrual_line_test"), context={})
163
assert accrual_line.state == 'posted', ("Line was not posted!")