odoo/addons/point_of_sale/test/account_statement_reports.yml

84 lines
3.2 KiB
YAML

-
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_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
-
!python {model: account.bank.statement.line}: |
partner = self.onchange_partner_id(cr, uid, [], ref('base.res_partner_4'), context=None)
vals = {
'account_id': partner['value']['account_id'],
'amount': 1000.0,
'partner_id': ref('base.res_partner_4'),
'statement_id': ref('account_bank_statement_0'),
'name': 'EXT001'
}
vals.update(partner.get('value',{}))
line_id = self.create(cr, uid, vals)
assert line_id, "Account bank statement line has not been created"
-
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 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)
-
Print the closed cashbox of the day 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_closedcashbox', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-closedcashbox.'+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)