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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
-
In order to test Cash Register I create a Cash Register with a journal in EURO, then I confirm it and check it's move created
-
I create a Cash Register with Opening and Closing balance 1500.
-
!record {model: account.bank.statement, id: account_bank_statement_1}:
date: !eval time.strftime('%Y-%m-%d')
journal_id: account.cash_journal
name:
period_id: account.period_10
user_id: base.user_root
starting_details_ids:
- pieces: 100.0
number: 10
subtotal: 1000.0
- pieces: 100.0
number: 5
subtotal: 500.0
balance_start: 1500.0
balance_end: 1500.0
-
I check that Initially Cash Register is in the "Draft" state
-
!assert {model: account.bank.statement, id: account_bank_statement_1}:
- state == 'draft'
-
I clicked on Open CashBox button to open the cashbox
-
!python {model: account.bank.statement}: |
self.button_open_cash(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", \
"active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
-
I check that now Cash register is in the "Open" state
-
!assert {model: account.bank.statement, id: account_bank_statement_1}:
- state == 'open'
-
I enter values in Closing balance before close the cashbox
-
!record {model: account.bank.statement, id: account_bank_statement_1}:
line_ids:
- account_id: account.a_recv
amount: 500.0
date: !eval time.strftime('%Y-%m-%d')
name: test1
partner_id: base.res_partner_4
sequence: 0.0
type: general
- account_id: account.a_recv
amount: 380.0
date: !eval time.strftime('%Y-%m-%d')
name: test2
partner_id: base.res_partner_3
sequence: 1.0
type: general
- account_id: account.a_recv
amount: 320.0
date: !eval time.strftime('%Y-%m-%d')
name: test3
partner_id: base.res_partner_4
sequence: 2.0
type: general
balance_end: 300.0
ending_details_ids:
- pieces: 50.0
number: 1
subtotal: 50.0
- pieces: 100.0
number: 2
subtotal: 200.0
balance_end_cash: 250.0
-
I clicked on each line to hard post them
-
!python {model: account.bank.statement.line}: |
absl_obj = self.pool.get('account.bank.statement.line')
absl_ids = absl_obj.search(cr, uid, [('statement_id', '=', ref("account_bank_statement_1"))])
for id in absl_ids:
absl_obj.button_hard_posting(cr, uid, [id])
-
I clicked on Close CashBox button to close the cashbox
-
!python {model: account.bank.statement}: |
self.button_confirm_cash(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", \
"active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
-
I click on "Are you sure ?" in the wizard to confirm cashbox closing
-
!record {model: wizard.closing.cashbox, id: wizard_closing_cashbox_1}:
be_sure: 1
-
I click on the 'Confirm' button to close the cashbox
-
!python {model: wizard.closing.cashbox}: |
self.button_close_cashbox(cr, uid, [ref("wizard_closing_cashbox_1")], { "active_ids": [ref("account_bank_statement_1")], \
"active_id": ref("account_bank_statement_1"), })
-
I check that bank statement state is now "Partial Close"
-
!assert {model: account.bank.statement, id: account_bank_statement_1}:
- state == 'partial_close'
-
I check that move lines created for bank statement and move state is Posted
-
!python {model: account.bank.statement}: |
move_line_obj = self.pool.get('account.move.line')
bank_data = self.browse(cr, uid, ref("account_bank_statement_1"))
assert bank_data.move_line_ids, "Move lines not created for bank statement"
for line in bank_data.move_line_ids:
assert line.move_id.state == 'posted', "Move state is not posted"
-
I launch the "Cash Discrepancy Case" wizard and do a write-off
-
!record {model: cashbox.write.off, id: cashbox_write_off_1}:
choice: writeoff
account_id: account.a_recv
-
I check that the amount is 50.0
-
!python {model: cashbox.write.off}: |
result = self.default_get(cr, uid, [ref("cashbox_write_off_1")], {"active_id": ref('account_bank_statement_1')})
result['amount'] == 50.0
-
I click on the 'Ok' button to do the write-off
-
!python {model: cashbox.write.off, id: cashbox_write_off_1}: |
self.action_confirm_choice(cr, uid, [ref("cashbox_write_off_1")], {"active_id": ref("account_bank_statement_1")})
|