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 address_invoice_id: base.res_partner_address_tang
8 partner_id: base.res_partner_asus
11 account_id: account.a_recv
13 address_contact_id: base.res_partner_address_tang
15 In order to test the PDF reports defined on an invoice, we will print an Invoice Report
17 !python {model: account.invoice}: |
18 import netsvc, tools, os
19 (data, format) = netsvc.LocalService('report.account.invoice').create(cr, uid, [ref('account.account_invoice_customer0')], {}, {})
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}: |
27 import netsvc, tools, os
28 (data, format) = netsvc.LocalService('report.account.overdue').create(cr, uid, [ref('base.res_partner_asus'),ref('base.res_partner_agrolait'),ref('base.res_partner_c2c')], {}, {})
29 if tools.config['test_report_directory']:
30 file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data)
32 Print the Aged Partner Balance Report
34 !python {model: account.account}: |
36 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
37 data_dict = {'chart_account_id':ref('account.chart0')}
38 from 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 Horizontal mode
43 !python {model: account.account}: |
45 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
46 data_dict = {'chart_account_id':ref('account.chart0'),'display_type': True}
47 from tools import test_reports
48 test_reports.try_report_action(cr, uid, 'action_account_bs_report',wiz_data=data_dict, context=ctx, our_module='account')
50 Print the Account Balance Sheet in Normal mode
52 !python {model: account.account}: |
54 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
55 data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False}
56 from tools import test_reports
57 test_reports.try_report_action(cr, uid, 'action_account_bs_report',wiz_data=data_dict, context=ctx, our_module='account')
59 Print the Account Balance Report in Normal mode through the wizard - From Account Chart
61 !python {model: account.account}: |
63 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
64 data_dict = {'chart_account_id':ref('account.chart0')}
65 from tools import test_reports
66 test_reports.try_report_action(cr, uid, 'action_account_balance_menu',wiz_data=data_dict, context=ctx, our_module='account')
68 Print the Central Journal Report - From Account
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 ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
75 data_dict = {'chart_account_id':ref('account.chart0')}
76 from tools import test_reports
77 test_reports.try_report_action(cr, uid, 'action_account_central_journal',wiz_data=data_dict, context=ctx, our_module='account')
79 Print the General Journal Report - From Journal
81 !python {model: account.journal.period}: |
82 journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),
83 ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
85 ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
86 data_dict = {'chart_account_id':ref('account.chart0')}
87 from tools import test_reports
88 test_reports.try_report_action(cr, uid, 'action_account_general_journal',wiz_data=data_dict, context=ctx, our_module='account')
90 Print the General Ledger Report in Normal Mode
92 !python {model: account.account}: |
94 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
95 data_dict = {'chart_account_id':ref('account.chart0'),'landscape':False}
96 from tools import test_reports
97 test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
99 Print the General Ledger Report in Landscape Mode
101 !python {model: account.account}: |
103 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
104 data_dict = {'chart_account_id':ref('account.chart0'),'landscape':True}
105 from tools import test_reports
106 test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
108 Print Journal Report - From Model
110 !python {model: account.journal.period}: |
111 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')]
113 ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
114 data_dict = {'chart_account_id':ref('account.chart0')}
115 from tools import test_reports
116 test_reports.try_report_action(cr, uid, 'action_account_print_journal',wiz_data=data_dict, context=ctx, our_module='account')
118 Print the Partner Balance Report
120 !python {model: account.account}: |
122 data_dict = {'chart_account_id':ref('account.chart0')}
123 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
124 from tools import test_reports
125 test_reports.try_report_action(cr, uid, 'action_account_partner_balance',wiz_data=data_dict, context=ctx, our_module='account')
127 Print the Partner Ledger Report
129 !python {model: account.account}: |
131 data_dict = {'chart_account_id':ref('account.chart0'),'page_split': True}
132 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
133 from tools import test_reports
134 test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
136 Print the Partner Ledger-Other Report
138 !python {model: res.partner}: |
140 data_dict = {'chart_account_id':ref('account.chart0'),'page_split': False}
141 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
142 from tools import test_reports
143 test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
145 Print the Profit-Loss Report in Normal Mode
147 !python {model: account.account}: |
149 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
150 data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False,'target_move': 'all'}
151 from tools import test_reports
152 test_reports.try_report_action(cr, uid, 'action_account_pl_report',wiz_data=data_dict, context=ctx, our_module='account')
154 Print the Profit-Loss Report in Horizontal Mode
156 !python {model: account.account}: |
158 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
159 data_dict = {'chart_account_id':ref('account.chart0'),'display_type': True,'target_move': 'all'}
160 from tools import test_reports
161 test_reports.try_report_action(cr, uid, 'action_account_pl_report',wiz_data=data_dict, context=ctx, our_module='account')
163 Print the Analytic Balance Report through the wizard
165 !python {model: account.analytic.account}: |
167 ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]})
169 from tools import test_reports
170 test_reports.try_report_action(cr, uid, 'action_account_analytic_balance',wiz_data=data_dict, context=ctx, our_module='account')
173 Print the Cost Ledger Report through the wizard
175 !python {model: account.analytic.account}: |
177 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')]})
179 from tools import test_reports
180 test_reports.try_report_action(cr, uid, 'action_account_analytic_cost',wiz_data=data_dict, context=ctx, our_module='account')
183 Print the Cost Ledger(Only Quantities) Report through the wizard
185 !python {model: account.analytic.account}: |
187 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')]})
189 from tools import test_reports
190 test_reports.try_report_action(cr, uid, 'action_account_analytic_cost_ledger_journal',wiz_data=data_dict, context=ctx, our_module='account')
193 Print the Analytic Journal Report through the wizard
195 !python {model: account.analytic.journal}: |
197 ctx.update({'model': 'account.analytic.journal','active_ids': [ref('account.cose_journal_sale'), ref('account.exp'), ref('account.sit')]})
199 from tools import test_reports
200 test_reports.try_report_action(cr, uid, 'action_account_analytic_journal',wiz_data=data_dict, context=ctx, our_module='account')
203 Print the Inverted Analytic Balance Report through the wizard
205 !python {model: account.analytic.account}: |
207 ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]})
209 from tools import test_reports
210 test_reports.try_report_action(cr, uid, 'action_account_analytic_invert_balance',wiz_data=data_dict, context=ctx, our_module='account')