odoo/addons/account_payment/test/draft2valid_bank_statement.yml

52 lines
2.0 KiB
YAML

-
In order to test the process of bank statement
-
I create a record for bank statement
-
!record {model: account.bank.statement, id: account_bank_statement_1}:
balance_end_real: 0.0
balance_start: 0.0
date: !eval time.strftime('%Y-%m-%d')
journal_id: account.bank_journal
name: /
period_id: account.period_10
-
In order to make entries in bank statement line, I import payment order lines.
-
!python {model: account.payment.populate.statement}: |
payment = self.pool.get('payment.order').browse(cr, uid, ref("payment_order_1"))
payment_line = payment.line_ids[0]
import_payment_id = self.create(cr, uid, {'lines': [(6,0,[payment_line.id])]})
self.populate_statement(cr, uid, [import_payment_id], {"statement_id": ref("account_bank_statement_1"),
"active_model": "account.bank.statement", "journal_type": "cash",
"active_id": ref("account_bank_statement_1")})
-
I check that payment line is import successfully in bank statement line.
-
!python {model: account.bank.statement}: |
bank = self.browse(cr, uid, ref("account_bank_statement_1"))
assert bank.line_ids, "bank statement line is not created."
-
I modify the bank statement and set the Closing Balance.
-
!record {model: account.bank.statement, id: account_bank_statement_1}:
balance_end_real: -14.0
-
I confirm the bank statement.
-
!python {model: account.bank.statement}: |
self.button_confirm_bank(cr, uid, [ref("account_bank_statement_1")])
-
I check that bank statement state is now "Confirm"
-
!assert {model: account.bank.statement, id: account_bank_statement_1}:
- state == 'confirm'
-
I check that move lines created for bank statement.
-
!python {model: account.bank.statement}: |
bank = self.browse(cr, uid, ref("account_bank_statement_1"))
move_line = bank.move_line_ids[0]
assert bank.move_line_ids, "Move lines not created for bank statement."
assert move_line.state == 'valid', "Move state is not valid."