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.report_invoice', {}, {})
20 if tools.config['test_report_directory']:
21 file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
23 In order to test the PDF reports defined on a partner, we will print the Overdue Report
25 !python {model: res.partner}: |
28 from openerp import tools
29 data, format = openerp.report.render_report(cr, uid, [ref('base.res_partner_1'),ref('base.res_partner_2'),ref('base.res_partner_12')], 'account.report_overdue', {}, {})
30 if tools.config['test_report_directory']:
31 file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data)
33 Print the Aged Partner Balance Report
35 !python {model: account.account}: |
37 data_dict = {'chart_account_id':ref('account.chart0')}
38 from openerp.tools import test_reports
39 test_reports.try_report_action(cr, uid, 'action_account_aged_balance_view',wiz_data=data_dict, context=ctx, our_module='account')
41 Print the Account Balance Sheet in Normal mode
43 !python {model: account.account}: |
45 data_dict = {'chart_account_id':ref('account.chart0'), 'account_report_id': ref('account_financial_report_balancesheet0')}
46 from openerp.tools import test_reports
47 test_reports.try_report_action(cr, uid, 'action_account_report',wiz_data=data_dict, context=ctx, our_module='account')
49 Print the Account Balance Report in Normal mode through the wizard - From Account Chart
51 !python {model: account.account}: |
53 data_dict = {'chart_account_id':ref('account.chart0')}
54 from openerp.tools import test_reports
55 test_reports.try_report_action(cr, uid, 'action_account_balance_menu',wiz_data=data_dict, context=ctx, our_module='account')
57 Print the Central Journal Report - From Account
59 !python {model: account.journal.period}: |
60 journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),
61 ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
63 data_dict = {'chart_account_id':ref('account.chart0')}
64 from openerp.tools import test_reports
65 test_reports.try_report_action(cr, uid, 'action_account_central_journal',wiz_data=data_dict, context=ctx, our_module='account')
67 Print the General Journal Report - From Journal
69 !python {model: account.journal.period}: |
70 journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),
71 ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
73 data_dict = {'chart_account_id':ref('account.chart0')}
74 from openerp.tools import test_reports
75 test_reports.try_report_action(cr, uid, 'action_account_general_journal',wiz_data=data_dict, context=ctx, our_module='account')
77 Print the General Ledger Report in Normal Mode
79 !python {model: account.account}: |
81 data_dict = {'chart_account_id':ref('account.chart0'),'landscape':False}
82 from openerp.tools import test_reports
83 test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
85 Print the General Ledger Report in Landscape Mode
87 !python {model: account.account}: |
88 ctx={'landscape': True}
89 data_dict = {'chart_account_id':ref('account.chart0')}
90 from openerp.tools import test_reports
91 test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
93 Print Journal Report - From Model
95 !python {model: account.journal.period}: |
96 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')]
98 data_dict = {'chart_account_id':ref('account.chart0'), 'period_from':ref('period_1'), 'period_to':ref('period_12')}
99 from openerp.tools import test_reports
100 test_reports.try_report_action(cr, uid, 'action_account_print_journal',wiz_data=data_dict, context=ctx, our_module='account')
102 Print the Partner Balance Report
104 !python {model: account.account}: |
106 data_dict = {'chart_account_id':ref('account.chart0')}
107 from openerp.tools import test_reports
108 test_reports.try_report_action(cr, uid, 'action_account_partner_balance',wiz_data=data_dict, context=ctx, our_module='account')
110 Print the Partner Ledger Report
112 !python {model: account.account}: |
114 data_dict = {'chart_account_id':ref('account.chart0'),'page_split': True}
115 from openerp.tools import test_reports
116 test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
118 Print the Partner Ledger-Other Report
120 !python {model: res.partner}: |
122 data_dict = {'chart_account_id':ref('account.chart0'),'page_split': False}
123 from openerp.tools import test_reports
124 test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
126 Print the Profit-Loss Report in Normal Mode
128 !python {model: account.account}: |
130 data_dict = {'chart_account_id':ref('account.chart0'), 'target_move': 'all', 'account_report_id': ref('account_financial_report_balancesheet0')}
131 from openerp.tools import test_reports
132 test_reports.try_report_action(cr, uid, 'action_account_report',wiz_data=data_dict, context=ctx, our_module='account')
134 Print the Analytic Balance Report through the wizard
136 !python {model: account.analytic.account}: |
138 ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]})
140 from openerp.tools import test_reports
141 test_reports.try_report_action(cr, uid, 'action_account_analytic_balance',wiz_data=data_dict, context=ctx, our_module='account')
144 Print the Cost Ledger Report through the wizard
146 !python {model: account.analytic.account}: |
148 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')]})
150 from openerp.tools import test_reports
151 test_reports.try_report_action(cr, uid, 'action_account_analytic_cost',wiz_data=data_dict, context=ctx, our_module='account')
154 Print the Cost Ledger(Only Quantities) Report through the wizard
156 !python {model: account.analytic.account}: |
158 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')]})
160 from openerp.tools import test_reports
161 test_reports.try_report_action(cr, uid, 'action_account_analytic_cost_ledger_journal',wiz_data=data_dict, context=ctx, our_module='account')
164 Print the Analytic Journal Report through the wizard
166 !python {model: account.analytic.journal}: |
168 ctx.update({'model': 'account.analytic.journal','active_ids': [ref('account.cose_journal_sale'), ref('account.exp'), ref('account.sit')]})
170 from openerp.tools import test_reports
171 test_reports.try_report_action(cr, uid, 'action_account_analytic_journal',wiz_data=data_dict, context=ctx, our_module='account')
174 Print the Inverted Analytic Balance Report through the wizard
176 !python {model: account.analytic.account}: |
178 ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]})
180 from openerp.tools import test_reports
181 test_reports.try_report_action(cr, uid, 'action_account_analytic_invert_balance',wiz_data=data_dict, context=ctx, our_module='account')