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}: |
16 import netsvc, tools, os
17 (data, format) = netsvc.LocalService('report.account.invoice').create(cr, uid, [ref('account.account_invoice_customer0')], {}, {})
18 if tools.config['test_report_directory']:
19 file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
22 In order to test the PDF reports defined on a partner, we will print the Overdue Report
24 !python {model: res.partner}: |
25 import netsvc, tools, os
26 (data, format) = netsvc.LocalService('report.account.overdue').create(cr, uid, [ref('base.res_partner_1'),ref('base.res_partner_2'),ref('base.res_partner_12')], {}, {})
27 if tools.config['test_report_directory']:
28 file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data)
30 Print the Aged Partner Balance Report
32 !python {model: account.account}: |
34 data_dict = {'chart_account_id':ref('account.chart0')}
35 from tools import test_reports
36 test_reports.try_report_action(cr, uid, 'action_account_aged_balance_view',wiz_data=data_dict, context=ctx, our_module='account')
38 Print the Account Balance Sheet in Normal mode
40 !python {model: account.account}: |
42 data_dict = {'chart_account_id':ref('account.chart0'), 'account_report_id': ref('account_financial_report_balancesheet0')}
43 from tools import test_reports
44 test_reports.try_report_action(cr, uid, 'action_account_report',wiz_data=data_dict, context=ctx, our_module='account')
46 Print the Account Balance Report in Normal mode through the wizard - From Account Chart
48 !python {model: account.account}: |
50 data_dict = {'chart_account_id':ref('account.chart0')}
51 from tools import test_reports
52 test_reports.try_report_action(cr, uid, 'action_account_balance_menu',wiz_data=data_dict, context=ctx, our_module='account')
54 Print the Central Journal Report - From Account
56 !python {model: account.journal.period}: |
57 journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),
58 ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
60 data_dict = {'chart_account_id':ref('account.chart0')}
61 from tools import test_reports
62 test_reports.try_report_action(cr, uid, 'action_account_central_journal',wiz_data=data_dict, context=ctx, our_module='account')
64 Print the General Journal Report - From Journal
66 !python {model: account.journal.period}: |
67 journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),
68 ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
70 data_dict = {'chart_account_id':ref('account.chart0')}
71 from tools import test_reports
72 test_reports.try_report_action(cr, uid, 'action_account_general_journal',wiz_data=data_dict, context=ctx, our_module='account')
74 Print the General Ledger Report in Normal Mode
76 !python {model: account.account}: |
78 data_dict = {'chart_account_id':ref('account.chart0'),'landscape':False}
79 from tools import test_reports
80 test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
82 Print the General Ledger Report in Landscape Mode
84 !python {model: account.account}: |
86 data_dict = {'chart_account_id':ref('account.chart0'),'landscape':True}
87 from tools import test_reports
88 test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
90 Print Journal Report - From Model
92 !python {model: account.journal.period}: |
93 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')]
95 data_dict = {'chart_account_id':ref('account.chart0'), 'period_from':ref('period_1'), 'period_to':ref('period_12')}
96 from tools import test_reports
97 test_reports.try_report_action(cr, uid, 'action_account_print_journal',wiz_data=data_dict, context=ctx, our_module='account')
99 Print the Partner Balance Report
101 !python {model: account.account}: |
103 data_dict = {'chart_account_id':ref('account.chart0')}
104 from tools import test_reports
105 test_reports.try_report_action(cr, uid, 'action_account_partner_balance',wiz_data=data_dict, context=ctx, our_module='account')
107 Print the Partner Ledger Report
109 !python {model: account.account}: |
111 data_dict = {'chart_account_id':ref('account.chart0'),'page_split': True}
112 from tools import test_reports
113 test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
115 Print the Partner Ledger-Other Report
117 !python {model: res.partner}: |
119 data_dict = {'chart_account_id':ref('account.chart0'),'page_split': False}
120 from tools import test_reports
121 test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
123 Print the Profit-Loss Report in Normal Mode
125 !python {model: account.account}: |
127 data_dict = {'chart_account_id':ref('account.chart0'), 'target_move': 'all', 'account_report_id': ref('account_financial_report_balancesheet0')}
128 from tools import test_reports
129 test_reports.try_report_action(cr, uid, 'action_account_report',wiz_data=data_dict, context=ctx, our_module='account')
131 Print the Analytic Balance Report through the wizard
133 !python {model: account.analytic.account}: |
135 ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]})
137 from tools import test_reports
138 test_reports.try_report_action(cr, uid, 'action_account_analytic_balance',wiz_data=data_dict, context=ctx, our_module='account')
141 Print the Cost Ledger Report through the wizard
143 !python {model: account.analytic.account}: |
145 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')]})
147 from tools import test_reports
148 test_reports.try_report_action(cr, uid, 'action_account_analytic_cost',wiz_data=data_dict, context=ctx, our_module='account')
151 Print the Cost Ledger(Only Quantities) Report through the wizard
153 !python {model: account.analytic.account}: |
155 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')]})
157 from tools import test_reports
158 test_reports.try_report_action(cr, uid, 'action_account_analytic_cost_ledger_journal',wiz_data=data_dict, context=ctx, our_module='account')
161 Print the Analytic Journal Report through the wizard
163 !python {model: account.analytic.journal}: |
165 ctx.update({'model': 'account.analytic.journal','active_ids': [ref('account.cose_journal_sale'), ref('account.exp'), ref('account.sit')]})
167 from tools import test_reports
168 test_reports.try_report_action(cr, uid, 'action_account_analytic_journal',wiz_data=data_dict, context=ctx, our_module='account')
171 Print the Inverted Analytic Balance Report through the wizard
173 !python {model: account.analytic.account}: |
175 ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]})
177 from tools import test_reports
178 test_reports.try_report_action(cr, uid, 'action_account_analytic_invert_balance',wiz_data=data_dict, context=ctx, our_module='account')