2 In order to test the PDF reports defined on an invoice, we will create a Invoice Record
4 !record {model: account.invoice, id: test_invoice_1}:
6 company_id: base.main_company
7 partner_id: base.res_partner_1
10 account_id: account.a_recv
13 In order to test the PDF reports defined on an invoice, we will print an Invoice Report
15 !python {model: account.invoice}: |
18 from openerp import tools
19 data, format = openerp.report.render_report(cr, uid, [ref('account.account_invoice_customer0')], 'account.invoice', {}, {})
20 if tools.config['test_report_directory']:
21 file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
24 In order to test the PDF reports defined on a partner, we will print the Overdue Report
26 !python {model: res.partner}: |
29 from openerp import tools
30 data, format = openerp.report.render_report(cr, uid, [ref('base.res_partner_1'),ref('base.res_partner_2'),ref('base.res_partner_12')], 'account.overdue', {}, {})
31 if tools.config['test_report_directory']:
32 file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data)
34 Print the Aged Partner Balance Report
36 !python {model: account.account}: |
38 data_dict = {'chart_account_id':ref('account.chart0')}
39 from openerp.tools import test_reports
40 test_reports.try_report_action(cr, uid, 'action_account_aged_balance_view',wiz_data=data_dict, context=ctx, our_module='account')
42 Print the Account Balance Sheet in Normal mode
44 !python {model: account.account}: |
46 data_dict = {'chart_account_id':ref('account.chart0'), 'account_report_id': ref('account_financial_report_balancesheet0')}
47 from openerp.tools import test_reports
48 test_reports.try_report_action(cr, uid, 'action_account_report',wiz_data=data_dict, context=ctx, our_module='account')
50 Print the Account Balance Report in Normal mode through the wizard - From Account Chart
52 !python {model: account.account}: |
54 data_dict = {'chart_account_id':ref('account.chart0')}
55 from openerp.tools import test_reports
56 test_reports.try_report_action(cr, uid, 'action_account_balance_menu',wiz_data=data_dict, context=ctx, our_module='account')
58 Print the Central Journal Report - From Account
60 !python {model: account.journal.period}: |
61 journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),
62 ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
64 data_dict = {'chart_account_id':ref('account.chart0')}
65 from openerp.tools import test_reports
66 test_reports.try_report_action(cr, uid, 'action_account_central_journal',wiz_data=data_dict, context=ctx, our_module='account')
68 Print the General Journal Report - From Journal
70 !python {model: account.journal.period}: |
71 journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),
72 ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
74 data_dict = {'chart_account_id':ref('account.chart0')}
75 from openerp.tools import test_reports
76 test_reports.try_report_action(cr, uid, 'action_account_general_journal',wiz_data=data_dict, context=ctx, our_module='account')
78 Print the General Ledger Report in Normal Mode
80 !python {model: account.account}: |
82 data_dict = {'chart_account_id':ref('account.chart0'),'landscape':False}
83 from openerp.tools import test_reports
84 test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
86 Print the General Ledger Report in Landscape Mode
88 !python {model: account.account}: |
90 data_dict = {'chart_account_id':ref('account.chart0'),'landscape':True}
91 from openerp.tools import test_reports
92 test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
94 Print Journal Report - From Model
96 !python {model: account.journal.period}: |
97 journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
99 data_dict = {'chart_account_id':ref('account.chart0'), 'period_from':ref('period_1'), 'period_to':ref('period_12')}
100 from openerp.tools import test_reports
101 test_reports.try_report_action(cr, uid, 'action_account_print_journal',wiz_data=data_dict, context=ctx, our_module='account')
103 Print the Partner Balance Report
105 !python {model: account.account}: |
107 data_dict = {'chart_account_id':ref('account.chart0')}
108 from openerp.tools import test_reports
109 test_reports.try_report_action(cr, uid, 'action_account_partner_balance',wiz_data=data_dict, context=ctx, our_module='account')
111 Print the Partner Ledger Report
113 !python {model: account.account}: |
115 data_dict = {'chart_account_id':ref('account.chart0'),'page_split': True}
116 from openerp.tools import test_reports
117 test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
119 Print the Partner Ledger-Other Report
121 !python {model: res.partner}: |
123 data_dict = {'chart_account_id':ref('account.chart0'),'page_split': False}
124 from openerp.tools import test_reports
125 test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
127 Print the Profit-Loss Report in Normal Mode
129 !python {model: account.account}: |
131 data_dict = {'chart_account_id':ref('account.chart0'), 'target_move': 'all', 'account_report_id': ref('account_financial_report_balancesheet0')}
132 from openerp.tools import test_reports
133 test_reports.try_report_action(cr, uid, 'action_account_report',wiz_data=data_dict, context=ctx, our_module='account')
135 Print the Analytic Balance Report through the wizard
137 !python {model: account.analytic.account}: |
139 ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]})
141 from openerp.tools import test_reports
142 test_reports.try_report_action(cr, uid, 'action_account_analytic_balance',wiz_data=data_dict, context=ctx, our_module='account')
145 Print the Cost Ledger Report through the wizard
147 !python {model: account.analytic.account}: |
149 ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root'),ref('account.analytic_absences'),ref('account.analytic_internal'),ref('account.analytic_our_super_product')]})
151 from openerp.tools import test_reports
152 test_reports.try_report_action(cr, uid, 'action_account_analytic_cost',wiz_data=data_dict, context=ctx, our_module='account')
155 Print the Cost Ledger(Only Quantities) Report through the wizard
157 !python {model: account.analytic.account}: |
159 ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root'),ref('account.analytic_absences'),ref('account.analytic_internal'),ref('account.analytic_our_super_product')]})
161 from openerp.tools import test_reports
162 test_reports.try_report_action(cr, uid, 'action_account_analytic_cost_ledger_journal',wiz_data=data_dict, context=ctx, our_module='account')
165 Print the Analytic Journal Report through the wizard
167 !python {model: account.analytic.journal}: |
169 ctx.update({'model': 'account.analytic.journal','active_ids': [ref('account.cose_journal_sale'), ref('account.exp'), ref('account.sit')]})
171 from openerp.tools import test_reports
172 test_reports.try_report_action(cr, uid, 'action_account_analytic_journal',wiz_data=data_dict, context=ctx, our_module='account')
175 Print the Inverted Analytic Balance Report through the wizard
177 !python {model: account.analytic.account}: |
179 ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]})
181 from openerp.tools import test_reports
182 test_reports.try_report_action(cr, uid, 'action_account_analytic_invert_balance',wiz_data=data_dict, context=ctx, our_module='account')