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 In order to test the PDF reports defined on Account Move, we will print the Voucher Report
34 !python {model: account.move}: |
35 import netsvc, tools, os
36 (data, format) = netsvc.LocalService('report.account.move.voucher').create(cr, uid, [ref('account.account_move_0')], {}, {})
37 if tools.config['test_report_directory']:
38 file(os.path.join(tools.config['test_report_directory'], 'account-voucher-report.'+format), 'wb+').write(data)
40 Print the Aged Partner Balance Report
42 !python {model: account.account}: |
44 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
45 data_dict = {'chart_account_id':ref('account.chart0')}
46 from tools import test_reports
47 test_reports.try_report_action(cr, uid, 'action_account_aged_balance_view',wiz_data=data_dict, context=ctx, our_module='account')
49 Print the Account Balance Sheet in Horizontal mode
51 !python {model: account.account}: |
53 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
54 data_dict = {'chart_account_id':ref('account.chart0'),'display_type': True}
55 from tools import test_reports
56 test_reports.try_report_action(cr, uid, 'action_account_bs_report',wiz_data=data_dict, context=ctx, our_module='account')
58 Print the Account Balance Sheet in Normal mode
60 !python {model: account.account}: |
62 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
63 data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False}
64 from tools import test_reports
65 test_reports.try_report_action(cr, uid, 'action_account_bs_report',wiz_data=data_dict, context=ctx, our_module='account')
67 Print the Account Balance Report in Normal mode through the wizard - From Account Chart
69 !python {model: account.account}: |
71 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
72 data_dict = {'chart_account_id':ref('account.chart0')}
73 from tools import test_reports
74 test_reports.try_report_action(cr, uid, 'action_account_balance_menu',wiz_data=data_dict, context=ctx, our_module='account')
76 Print the Central Journal Report - From Account
78 !python {model: account.journal.period}: |
79 journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),
80 ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
82 ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
83 data_dict = {'chart_account_id':ref('account.chart0')}
84 from tools import test_reports
85 test_reports.try_report_action(cr, uid, 'action_account_central_journal',wiz_data=data_dict, context=ctx, our_module='account')
87 Print the General Journal Report - From Journal
89 !python {model: account.journal.period}: |
90 journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),
91 ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
93 ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
94 data_dict = {'chart_account_id':ref('account.chart0')}
95 from tools import test_reports
96 test_reports.try_report_action(cr, uid, 'action_account_general_journal',wiz_data=data_dict, context=ctx, our_module='account')
98 Print the General Ledger Report in Normal Mode
100 !python {model: account.account}: |
102 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
103 data_dict = {'chart_account_id':ref('account.chart0'),'landscape':False}
104 from tools import test_reports
105 test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
107 Print the General Ledger Report in Landscape Mode
109 !python {model: account.account}: |
111 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
112 data_dict = {'chart_account_id':ref('account.chart0'),'landscape':True}
113 from tools import test_reports
114 test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
116 Print Journal Report - From Model
118 !python {model: account.journal.period}: |
119 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')]
121 ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
122 data_dict = {'chart_account_id':ref('account.chart0')}
123 from tools import test_reports
124 test_reports.try_report_action(cr, uid, 'action_account_print_journal',wiz_data=data_dict, context=ctx, our_module='account')
126 Print the Partner Balance Report
128 !python {model: account.account}: |
130 data_dict = {'chart_account_id':ref('account.chart0')}
131 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
132 from tools import test_reports
133 test_reports.try_report_action(cr, uid, 'action_account_partner_balance',wiz_data=data_dict, context=ctx, our_module='account')
135 Print the Partner Ledger Report
137 !python {model: account.account}: |
139 data_dict = {'chart_account_id':ref('account.chart0'),'page_split': True}
140 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
141 from tools import test_reports
142 test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
144 Print the Partner Ledger-Other Report
146 !python {model: res.partner}: |
148 data_dict = {'chart_account_id':ref('account.chart0'),'page_split': False}
149 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
150 from tools import test_reports
151 test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
153 Print the Profit-Loss Report in Normal Mode
155 !python {model: account.account}: |
157 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
158 data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False}
159 from tools import test_reports
160 test_reports.try_report_action(cr, uid, 'action_account_pl_report',wiz_data=data_dict, context=ctx, our_module='account')
162 Print the Profit-Loss Report in Horizontal Mode
164 !python {model: account.account}: |
166 ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
167 data_dict = {'chart_account_id':ref('account.chart0'),'display_type': True}
168 from tools import test_reports
169 test_reports.try_report_action(cr, uid, 'action_account_pl_report',wiz_data=data_dict, context=ctx, our_module='account')