-
  In order to test the reports on Bank Statement defined in point_of_sale module, I create a bank statement line, confirm it and print the reports
-
  I select the period and journal for the bank statement
-
  !python {model: account.bank.statement}: |
    import time
    journal = self._default_journal_id(cr, uid, {'lang': u'en_US', 'tz': False, 'active_model': 'ir.ui.menu',
      'journal_type': 'bank', 'period_id': time.strftime('%m'), 'active_ids': [ref('account.menu_bank_statement_tree')], 'active_id': ref('account.menu_bank_statement_tree')})
    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')
    journal_id: account.bank_journal
-
  I create bank statement line
-
  !record {model: account.bank.statement.line, id: account_bank_statement_line_0}:
    amount: 1000.0
    partner_id: base.res_partner_4
    statement_id: account_bank_statement_0
    name: 'EXT001'
-
  I compute bank statement using Compute button
-
  !python {model: account.bank.statement}: |
    self.button_dummy(cr, uid, [ref("account_bank_statement_0")])
-
  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 reconcile the bank statement.
-
  !python {model: account.bank.statement.line}: |
    counterpart_line_dict = {
        'account_id': self.pool.get('res.partner').browse(cr, uid, ref('base.res_partner_4')).property_account_receivable.id,
        'name': "EXT001",
        'credit': 1000.0
    }
    self.process_reconciliation(cr, uid, ref("account_bank_statement_line_0"), [counterpart_line_dict])
-
  I confirm the bank statement using Confirm button
-
  !python {model: account.bank.statement}: |
    self.button_confirm_bank(cr, uid, [ref("account_bank_statement_0")])
-
  Print the account statement report
-
  !python {model: account.bank.statement}: |
    import os
    import openerp.report
    from openerp import tools
    data, format = openerp.report.render_report(cr, uid, [ref('account_bank_statement_0')], 'point_of_sale.report_statement', {}, {})
    if tools.config['test_report_directory']:
        file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-statement.'+format), 'wb+').write(data)

-
  Printing the user s product report
-
  !python {model: account.bank.statement}: |
    import os
    import openerp.report
    from openerp import tools
    data, format = openerp.report.render_report(cr, uid, [ref('account_bank_statement_0')], 'point_of_sale.report_usersproduct', {}, {})
    if tools.config['test_report_directory']:
        file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-usersproduct.'+format), 'wb+').write(data)

