1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
-
Validate donation1
-
!function {model: donation.donation, name: validate}:
- eval: "[obj(ref('donation1')).id]"
-
Donation1 Check that an account move has been generated
-
!assert {model: donation.donation, id: donation1, string: Donation1 was not correctly validated}:
- state == 'done'
- move_id.date == time.strftime('%Y-%m-01')
- move_id.journal_id.id == ref('account.check_journal')
- move_id.state == 'posted'
- move_id.ref == 'CHQ BNP 239023'
-
Validate donation2
-
!function {model: donation.donation, name: validate}:
- eval: "[obj(ref('donation2')).id]"
-
Donation2 Check that an account move has been generated
-
!assert {model: donation.donation, id: donation2, string: Donation2 was not correctly validated}:
- state == 'done'
- move_id.date == time.strftime('%Y-%m-01')
- move_id.journal_id.id == ref('account.cash_journal')
- move_id.state == 'posted'
-
Validate donation3
-
!function {model: donation.donation, name: validate}:
- eval: "[obj(ref('donation3')).id]"
-
Donation3 Check that an account move has been generated
-
!assert {model: donation.donation, id: donation3, string: Donation3 was not correctly validated}:
- state == 'done'
- move_id.date == time.strftime('%Y-%m-01')
- move_id.journal_id.id == ref('account.cash_journal')
- move_id.state == 'posted'
-
Validate donation4
-
!function {model: donation.donation, name: validate}:
- eval: "[obj(ref('donation4')).id]"
-
Donation4 Check that no account move has been generated (full in-kind donation)
-
!python {model: donation.donation}: |
donation = self.browse(cr, uid, ref('donation4'), context=context)
assert donation.state == 'done', 'Donation has not been set to done (donation4)'
assert not donation.move_id, 'Donation should not have an account move (donation4)'
-
Validate donation5
-
!function {model: donation.donation, name: validate}:
- eval: "[obj(ref('donation5')).id]"
-
Donation5 Check that an account move has been generated (partial in-kind donation)
-
!python {model: donation.donation}: |
donation = self.browse(cr, uid, ref('donation5'), context=context)
assert donation.state == 'done', 'Donation has not been set to done (donation5)'
assert donation.move_id, 'No account move generated (donation5)'
# How to make this check work when the company currency != EUR ?
assert donation.move_id.amount == 400, 'Wrong amount on account move'
|