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

« back to all changes in this revision

Viewing changes to financing_contract/test/financing_contract.yml

  • Committer: Olivier DOSSMANN
  • Date: 2011-12-28 15:38:17 UTC
  • mto: This revision was merged to the branch mainline in revision 492.
  • Revision ID: olivier@tempo-laptop-20111228153817-rd119phuevo66e3y
UF-675 [FIX] Engagement lines deletion when a PO is cancelled.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    code: "OC1"
25
25
    category: OC
26
26
-
27
 
 ...a cost center...
28
 
-
29
 
  !record {model: account.analytic.account, id: analytic_account_OC2}:
30
 
    name: "OC2"
31
 
    code: "OC2"
32
 
    category: OC
33
 
-
34
27
 ...a funding pool...
35
28
-
36
29
  !record {model: account.analytic.account, id: analytic_account_FP1}:
38
31
    code: "FP1"
39
32
    category: FUNDING
40
33
    cost_center_ids:
41
 
      - analytic_account_OC2
42
 
    account_ids:
43
 
      - test_expense
44
 
-
45
 
 ...a funding pool...
46
 
-
47
 
  !record {model: account.analytic.account, id: analytic_account_FP2}:
48
 
    name: "FP1"
49
 
    code: "FP1"
50
 
    category: FUNDING
51
 
    cost_center_ids:
52
34
      - analytic_account_OC1
53
 
      - analytic_account_OC2
54
35
    account_ids:
55
36
      - test_expense
56
37
-
124
105
      currency_id: base.CHF
125
106
      date: !eval "'%s-03-12' %(datetime.now().year+1)"
126
107
-
127
 
  ... and another distribution.
128
 
-
129
 
  !record {model: analytic.distribution, id: distribution_test_2}:
130
 
    cost_center_lines: 
131
 
    - analytic_id: analytic_account_OC1
132
 
      amount: 10000.0
133
 
      currency_id: base.CHF
134
 
      date: !eval "'%s-03-12' %(datetime.now().year+1)"
135
 
    - analytic_id: analytic_account_OC2
136
 
      amount: 2345.0
137
 
      currency_id: base.CHF
138
 
      date: !eval "'%s-03-12' %(datetime.now().year+1)"
139
 
    funding_pool_lines:
140
 
    - analytic_id: analytic_account_FP2
141
 
      cost_center_id: analytic_account_OC1
142
 
      amount: 10000.0
143
 
      currency_id: base.CHF
144
 
      date: !eval "'%s-03-12' %(datetime.now().year+1)"
145
 
    - analytic_id: analytic_account_FP2
146
 
      cost_center_id: analytic_account_OC2
147
 
      amount: 2345.0
148
 
      currency_id: base.CHF
149
 
      date: !eval "'%s-03-12' %(datetime.now().year+1)"
150
 
-
151
108
  I create an account move line with all of this.
152
109
-
153
110
  !record {model: account.move.line, id: move_line_test}:
159
116
    date: !eval "'%s-03-12' %(datetime.now().year+1)"
160
117
    debit_currency: 4242.0
161
118
    analytic_distribution_id: distribution_test
162
 
-
163
 
  I create an account move line with all of this.
164
 
-
165
 
  !record {model: account.move.line, id: move_line_test_2}:
166
 
    name: testline2
167
 
    journal_id: account_journal_1
168
 
    period_id: account_period_mar0
169
 
    account_id: test_expense
170
 
    currency_id: base.CHF
171
 
    date: !eval "'%s-03-12' %(datetime.now().year+1)"
172
 
    debit_currency: 12345.0
173
 
    analytic_distribution_id: distribution_test_2
174
119
      
175
120
-
176
121
  Analytic lines are created from it
177
122
-
178
123
  !python {model: account.move.line}: |
179
 
    self.create_analytic_lines(cr, uid, [ref("move_line_test"), ref("move_line_test_2")], context={})
 
124
    self.create_analytic_lines(cr, uid, [ref("move_line_test")], context={})
180
125
 
181
126
-
182
127
  Create a donor (almost empty)
197
142
    eligibility_to_date: !eval "'%s-12-31' %(datetime.now().year+1)"
198
143
    reporting_currency: base.CHF
199
144
    funding_pool_ids:
200
 
      - funding_pool_id: analytic_account_FP1
201
 
        funded: True
202
 
      - funding_pool_id: analytic_account_FP2
203
 
        funded: False
204
 
    cost_center_ids:
205
 
      - analytic_account_OC1
 
145
      - analytic_account_FP1
206
146
    actual_line_ids:
207
147
      - name: "A"
208
148
        code: "A"
209
149
        account_ids:
210
150
          - test_expense
211
151
-
212
 
  Assert that total retrieved for funded is 2121 CHF, and project is 12121 CHF
 
152
  Assert that total retrieved for funded is 2121 CHF
213
153
-
214
154
  !python {model: financing.contract.contract}: |
215
155
    context = {"reporting_currency": ref("base.CHF"),
216
156
               "reporting_type": "all",
217
157
               "currency_table_id": None}
218
 
    contract = self.pool.get('financing.contract.contract').browse(cr, uid, ref("contract1"), context=context)
219
 
    assert len(contract.actual_line_ids) == 1, ("No reporting line!")
220
 
    assert contract.actual_line_ids[0].allocated_real == 2121, ("Allocation is not what is expected!")
221
 
    assert contract.actual_line_ids[0].project_real == 12121, ("Project is not what is expected!")
 
158
    contract = self.browse(cr, uid, ref("contract1"), context=context)
 
159
    assert contract.report_line.allocated_real == 2121.0, ("Allocation is not what is expected!")
222
160
-
223
161
  Assert that total retrieved for funded is 212100 EUR
224
162
-
226
164
    context = {"reporting_currency": ref("base.EUR"),
227
165
               "reporting_type": "all",
228
166
               "currency_table_id": None}
229
 
    contract = self.pool.get('financing.contract.contract').browse(cr, uid, ref("contract1"), context=context)
230
 
    assert len(contract.actual_line_ids) == 1, ("No reporting line!")
231
 
    assert contract.actual_line_ids[0].allocated_real == 212100, ("Allocation is not what is expected!")
232
 
    assert contract.actual_line_ids[0].project_real == 1212100, ("Project is not what is expected!")
 
167
    contract = self.browse(cr, uid, ref("contract1"), context=context)
 
168
    assert contract.report_line.allocated_real == 212100.0, ("Allocation is not what is expected!")
233
169
-
234
170
  Create a currency table
235
171
-
255
191
    context = {"reporting_currency": ref("base.EUR"),
256
192
               "reporting_type": "all",
257
193
               "currency_table_id": ref("test_table")}
258
 
    contract = self.pool.get('financing.contract.contract').browse(cr, uid, ref("contract1"), context=context)
259
 
    assert len(contract.actual_line_ids) == 1, ("No reporting line!")
260
 
    assert contract.actual_line_ids[0].allocated_real == 21210, ("Allocation is not what is expected!")
261
 
    assert contract.actual_line_ids[0].project_real == 121210, ("Project is not what is expected!")
 
194
    contract = self.browse(cr, uid, ref("contract1"), context=context)
 
195
    assert contract.report_line.allocated_real == 21210.0, ("Allocation is not what is expected!")
262
196
    
 
 
b'\\ No newline at end of file'