-
  !context
    journal_type: 'bank'
-
  In order to test Bank Statement feature of account I create a bank statement line and confirm it and check it's move created
-
  I select the period and journal for the bank statement
-
  !python {model: account.bank.statement}: |
    import time
    journal = self._default_journal(cr, uid, {'lang': u'en_US', 'tz': False, 'active_model': 'ir.ui.menu',
      'journal_type': 'bank', 'date': time.strftime("%Y/%m/%d")})
    assert journal, 'Journal has not been selected'
-
  I create a bank statement with Opening and Closing balance 0.
-
  !record {model: account.bank.statement, id: account_bank_statement_0}:
    balance_end_real: 0.0
    balance_start: 0.0
    date: !eval time.strftime('%Y-%m-%d')
    company_id: base.main_company
-
  !python {model: account.bank.statement.line}: |
    import time
    account_id = self.pool.get('account.account').search(cr, uid, [('user_type_id.type', '=', 'liquidity'), ('currency_id', '=', False)])[0]
    vals = {
        'amount': 1000,
        'date': time.strftime('%Y-%m-%d'),
        'partner_id': ref('base.res_partner_4'),
        'name': 'EXT001',
        'statement_id': ref('account_bank_statement_0'),
    }
    self.create(cr, uid, vals)
-
  I process the bank statement line
-
  !python {model: account.bank.statement}: |
    account_id = self.pool.get('account.account').create(cr, uid, {'name': 'toto', 'code': 'bidule', 'user_type_id': self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, 'account.data_account_type_fixed_assets')})
    statement = self.browse(cr, uid, [ref("account_bank_statement_0")])
    statement.line_ids[0].process_reconciliation(new_aml_dicts=[{
        'credit': 1000,
        'debit': 0,
        'name': 'toto',
        'account_id': account_id,
    }])
-
  I modify the bank statement and set the Closing Balance.
-
  !record {model: account.bank.statement, id: account_bank_statement_0}:
    balance_end_real: 1000.0
-
  I confirm the bank statement using Confirm button
-
  !python {model: account.bank.statement}: |
    self.button_confirm_bank(cr, uid, [ref("account_bank_statement_0")])
-
  I check that bank statement state is now "Closed"
-
  !assert {model: account.bank.statement, id: account_bank_statement_0}:
    - state == 'confirm'
