[IMP]:improved code
[odoo/odoo.git] / addons / account / test / account_report.yml
1 -
2   In order to test the PDF reports defined on an invoice, we will create a Invoice Record
3 -
4   !record {model: account.invoice, id: test_invoice_1}:
5     currency_id: base.EUR
6     company_id: base.main_company
7     address_invoice_id: base.res_partner_address_tang
8     partner_id: base.res_partner_asus
9     state: draft
10     type: out_invoice
11     account_id: account.a_recv
12     name: Test invoice 1
13     address_contact_id: base.res_partner_address_tang
14 -
15   In order to test the PDF reports defined on an invoice, we will print an Invoice Report
16 -
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)
22
23 -
24   In order to test the PDF reports defined on a partner, we will print the Overdue Report
25 -
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)
31 -
32   In order to test the PDF reports defined on Account Move, we will print the Voucher Report
33 -
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)
39 -
40   Print the Aged Partner Balance Report
41 -
42   !python {model: account.account}: |
43     ctx={}
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') 
48 -
49   Print the Account Balance Sheet in Horizontal mode
50 -
51   !python {model: account.account}: |
52     ctx={}
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')    
57 -
58   Print the Account Balance Sheet in Normal mode
59 -
60   !python {model: account.account}: |
61     ctx={}
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') 
66 -
67   Print the Account Balance Report in Normal mode through the wizard - From Account Chart
68 -
69   !python {model: account.account}: |
70     ctx={}
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')
75 -
76   Print the Central Journal Report - From Account
77 -
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')]
81     ctx={}
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')
86 -
87   Print the General Journal Report - From Journal
88 -
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')]
92     ctx={}
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')
97 -
98   Print the General Ledger Report in Normal Mode
99 -
100   !python {model: account.account}: |
101     ctx={}
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')
106 -
107   Print the General Ledger Report in Landscape Mode
108 -
109   !python {model: account.account}: |
110     ctx={}
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')
115 -
116   Print Journal Report - From Model
117 -
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')]
120     ctx={}
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')
125 -
126   Print the Partner Balance Report
127 -
128   !python {model: account.account}: |
129     ctx={}
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')
134 -
135   Print the Partner Ledger Report
136 -
137   !python {model: account.account}: |
138     ctx={}
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')
143 -
144   Print the Partner Ledger-Other Report
145 -
146   !python {model: res.partner}: |
147     ctx={}
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')
152 -
153   Print the Profit-Loss Report in Normal Mode
154 -
155   !python {model: account.account}: |
156     ctx={}
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')    
161 -
162   Print the Profit-Loss Report in Horizontal Mode
163 -
164   !python {model: account.account}: |
165     ctx={}
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')