2
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
4
I create a Cash Register with Opening and Closing balance 1500.
6
!record {model: account.bank.statement, id: account_bank_statement_1}:
7
date: !eval time.strftime('%Y-%m-%d')
8
journal_id: account.cash_journal
10
period_id: account.period_10
11
user_id: base.user_root
22
I check that Initially Cash Register is in the "Draft" state
24
!assert {model: account.bank.statement, id: account_bank_statement_1}:
27
I clicked on Open CashBox button to open the cashbox
29
!python {model: account.bank.statement}: |
30
self.button_open_cash(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", \
31
"active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
33
I check that now Cash register is in the "Open" state
35
!assert {model: account.bank.statement, id: account_bank_statement_1}:
38
I enter values in Closing balance before close the cashbox
40
!record {model: account.bank.statement, id: account_bank_statement_1}:
42
- account_id: account.a_recv
44
date: !eval time.strftime('%Y-%m-%d')
46
partner_id: base.res_partner_4
49
- account_id: account.a_recv
51
date: !eval time.strftime('%Y-%m-%d')
53
partner_id: base.res_partner_3
56
- account_id: account.a_recv
58
date: !eval time.strftime('%Y-%m-%d')
60
partner_id: base.res_partner_4
71
balance_end_cash: 250.0
73
I clicked on each line to hard post them
75
!python {model: account.bank.statement.line}: |
76
absl_obj = self.pool.get('account.bank.statement.line')
77
absl_ids = absl_obj.search(cr, uid, [('statement_id', '=', ref("account_bank_statement_1"))])
79
absl_obj.button_hard_posting(cr, uid, [id])
81
I clicked on Close CashBox button to close the cashbox
83
!python {model: account.bank.statement}: |
84
self.button_confirm_cash(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", \
85
"active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
87
I click on "Are you sure ?" in the wizard to confirm cashbox closing
89
!record {model: wizard.closing.cashbox, id: wizard_closing_cashbox_1}:
92
I click on the 'Confirm' button to close the cashbox
94
!python {model: wizard.closing.cashbox}: |
95
self.button_close_cashbox(cr, uid, [ref("wizard_closing_cashbox_1")], { "active_ids": [ref("account_bank_statement_1")], \
96
"active_id": ref("account_bank_statement_1"), })
98
I check that bank statement state is now "Partial Close"
100
!assert {model: account.bank.statement, id: account_bank_statement_1}:
101
- state == 'partial_close'
103
I check that move lines created for bank statement and move state is Posted
105
!python {model: account.bank.statement}: |
106
move_line_obj = self.pool.get('account.move.line')
107
bank_data = self.browse(cr, uid, ref("account_bank_statement_1"))
108
assert bank_data.move_line_ids, "Move lines not created for bank statement"
109
for line in bank_data.move_line_ids:
110
assert line.move_id.state == 'posted', "Move state is not posted"
112
I launch the "Cash Discrepancy Case" wizard and do a write-off
114
!record {model: cashbox.write.off, id: cashbox_write_off_1}:
116
account_id: account.a_recv
118
I check that the amount is 50.0
120
!python {model: cashbox.write.off}: |
121
result = self.default_get(cr, uid, [ref("cashbox_write_off_1")], {"active_id": ref('account_bank_statement_1')})
122
result['amount'] == 50.0
124
I click on the 'Ok' button to do the write-off
126
!python {model: cashbox.write.off, id: cashbox_write_off_1}: |
127
self.action_confirm_choice(cr, uid, [ref("cashbox_write_off_1")], {"active_id": ref("account_bank_statement_1")})