2
I create an Expense Account Type.
4
!record {model: account.account.type, id: account_account_type_expense0}:
5
close_method: unreconciled
10
I create a 6101 Expense Account.
12
!record {model: account.account, id: account_account_expense0}:
13
code: '6101-expense-test'
14
company_id: base.main_company
15
currency_mode: current
18
user_type: account_account_type_expense0
19
activation_date: !eval datetime.today().strftime('%Y-01-01')
20
default_destination_id: analytic_distribution.analytic_account_destination_operation
21
destination_ids: [analytic_distribution.analytic_account_destination_operation, analytic_distribution.analytic_account_destination_support]
23
I create a link between 6101 expense account and Operation destination
25
!record {model: account.destination.link, id: tuple_operation_6101}:
26
account_id: account_account_expense0
27
destination_id: analytic_distribution.analytic_account_destination_operation
29
I create a link between 6101 expense account and Support destination
31
!record {model: account.destination.link, id: tuple_support_6101}:
32
account_id: account_account_expense0
33
destination_id: analytic_distribution.analytic_account_destination_support
35
I create an analytic account attached to OC (Operation Center) named Gabon
37
!record {model: account.analytic.account, id: analytic_account_gabon}:
43
parent_id: analytic_distribution.analytic_account_project
44
date: !eval "'%s-01-01' %(datetime.now().year + 2)"
46
I create an analytic account attached to OC (Operation Center) named Kenya
48
!record {model: account.analytic.account, id: analytic_account_kenya}:
54
parent_id: analytic_distribution.analytic_account_project
55
date: !eval "'%s-01-01' %(datetime.now().year + 2)"
57
I create an FP analytic account named Gabon Hospital attached to Gabon CC
59
!record {model: account.analytic.account, id: analytic_account_fp_gabon_hospital}:
60
name: "Gabon Hospital"
65
parent_id: analytic_distribution.analytic_account_funding_pool
66
date: !eval "'%s-01-01' %(datetime.now().year + 2)"
67
cost_center_ids: [analytic_account_gabon]
68
tuple_destination_account_ids: [tuple_operation_6101]
70
I create an FP analytic account named Kenya AIDS attached to Kenya CC
72
!record {model: account.analytic.account, id: analytic_account_fp_kenya_aids}:
78
parent_id: analytic_distribution.analytic_account_funding_pool
79
date: !eval "'%s-01-01' %(datetime.now().year + 2)"
80
cost_center_ids: [analytic_account_kenya]
81
tuple_destination_account_ids: [tuple_support_6101]
83
I create a global analytical distribution
85
!record {model: analytic.distribution, id: global_distrib_1}:
88
I create a cost center distribution line for gabon
90
!record {model: cost.center.distribution.line, id: cost_center_gabon}:
95
analytic_id: analytic_account_gabon
96
distribution_id: global_distrib_1
97
destination_id: analytic_distribution.analytic_account_destination_operation
99
I create a cost center distribution line for kenya
101
!record {model: cost.center.distribution.line, id: cost_center_kenya}:
106
analytic_id: analytic_account_kenya
107
distribution_id: global_distrib_1
108
destination_id: analytic_distribution.analytic_account_destination_support
110
I create a funding pool distribution line for gabon
112
!record {model: funding.pool.distribution.line, id: funding_pool_gabon}:
117
analytic_id: analytic_account_fp_gabon_hospital
118
distribution_id: global_distrib_1
119
cost_center_id: analytic_account_gabon
120
destination_id: analytic_distribution.analytic_account_destination_operation
122
I create a funding pool distribution line for kenya
124
!record {model: funding.pool.distribution.line, id: funding_pool_kenya}:
129
analytic_id: analytic_account_fp_kenya_aids
130
cost_center_id: analytic_account_kenya
131
destination_id: analytic_distribution.analytic_account_destination_support
132
distribution_id: global_distrib_1
134
I overwrite periods with right number and open them
136
!python {model: account.period}: |
138
period_ids = self.search(cr, uid, [], order='date_start, name')
139
for p in self.browse(cr, uid, period_ids):
140
self.write(cr, uid, [p.id], {'number': int(datetime.datetime.strptime(p.date_start, '%Y-%m-%d').strftime('%m'))})
141
self.action_set_state(cr, uid, period_ids, {'state': 'draft'})