[IMP]: Remove commented code.
[odoo/odoo.git] / addons / account / test / account_report.yml
1
2 -
3   In order to test the PDF reports defined on an invoice, we will print an Invoice Report
4 -
5   !python {model: account.invoice}: |
6     import netsvc, tools, os
7     (data, format) = netsvc.LocalService('report.account.invoice').create(cr, uid, [ref('account.account_invoice_customer0')], {}, {})
8     if tools.config['test_report_directory']:
9         file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
10
11 -
12   In order to test the PDF reports defined on a partner, we will print the Overdue Report
13 -
14   !python {model: res.partner}: |
15     import netsvc, tools, os
16     (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')], {}, {})
17     if tools.config['test_report_directory']:
18         file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data)
19
20 -
21   In order to test the PDF reports defined on Account Move, we will print the Voucher Report
22 -
23   !python {model: account.move}: |
24     import netsvc, tools, os
25     (data, format) = netsvc.LocalService('report.account.move.voucher').create(cr, uid, [ref('account.account_move_0')], {}, {})
26     if tools.config['test_report_directory']:
27         file(os.path.join(tools.config['test_report_directory'], 'account-voucher-report.'+format), 'wb+').write(data)
28
29 -
30   Print the Aged Partner Balance Report
31 -
32   !python {model: res.partner}: |
33     import netsvc, tools, os, time
34     from datetime import datetime
35     from dateutil.relativedelta import relativedelta
36     import warnings
37     import md5
38     import hashlib
39     warnings.filterwarnings('ignore',".*struct integer overflow masking is deprecated*")
40     start = datetime.fromtimestamp(time.mktime(time.strptime(time.strftime('%Y-%m-%d'), "%Y-%m-%d")))
41     start = datetime(int(start.year), int(start.month), int(start.day))
42     res = {}
43     for i in range(5)[::-1]:
44         stop = start - relativedelta(days=30)
45         res[str(i)] = {
46             'name': (i!=0 and (str((5-(i+1)) * 30) + '-' + str((5-i) * 30)) or ('+'+str(4 * 30))),
47             'stop': start.strftime('%Y-%m-%d'),
48             'start': (i!=0 and stop.strftime('%Y-%m-%d') or False),
49         }
50         start = stop - relativedelta(days=1)
51     obj_move = self.pool.get('account.move.line')
52     ctx = {}
53     fy_id = ref('account.data_fiscalyear')
54     period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
55     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')]
56     ctx['fiscalyear'] = fy_id
57     ctx['journal_ids'] = journal_ids
58     ctx['chart_account_id'] = ref('account.chart0')
59
60     query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
61
62     data_dict = {'model': 'ir.ui.menu', 'form': {'chart_account_id':ref('account.chart0'),'initial_balance': 1, 'periods': period_list,'journal_ids':journal_ids, 'page_split': 0, 'date_from': time.strftime('%Y-%m-%d'), 'period_length': 30, 'amount_currency': 0,'query_line' : query_line, 'result_selection': 'customer','direction_selection': 'past','fiscalyear_id':fy_id}}
63     data_dict['form'].update(res)
64     (data, format) = netsvc.LocalService('report.account.aged_trial_balance').create(cr, uid, [], data_dict, {})
65     if tools.config['test_report_directory']:
66        file(os.path.join(tools.config['test_report_directory'], 'account-aged_partner_balance.'+format), 'wb+').write(data)
67
68 -
69   Print the Account Balance Sheet in Horizontal mode
70 -
71   !python {model: account.account}: |
72     import netsvc, tools, os, time
73     data_dict = {'model': 'ir.ui.menu', 'form': {'reserve_account_id':ref('account.rsa') ,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 1,'journal_ids':[],'fiscalyear': ref('account.data_fiscalyear') ,'target_move': 'all'}}
74     (data, format) = netsvc.LocalService('report.account.balancesheet.horizontal').create(cr, uid, [], data_dict, {'periods': []})
75     if tools.config['test_report_directory']:
76        file(os.path.join(tools.config['test_report_directory'], 'account-account_balance_sheet_horizontal.'+format), 'wb+').write(data)
77
78 -
79   Print the Account Balance Sheet in Normal mode
80 -
81   !python {model: account.account}: |
82     import netsvc, tools, os, time
83     data_dict = {'model': 'ir.ui.menu', 'form': {'reserve_account_id':ref('account.rsa') ,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':[],'fiscalyear': ref('account.data_fiscalyear') ,'target_move': 'all'}}
84     (data, format) = netsvc.LocalService('report.account.balancesheet').create(cr, uid, [], data_dict, {'periods': []})
85     if tools.config['test_report_directory']:
86        file(os.path.join(tools.config['test_report_directory'], 'account-account_balance_sheet.'+format), 'wb+').write(data)
87
88 -
89   Print the Account Balance Report in Normal mode - From Account Chart
90 -
91   !python {model: account.account}: |
92     import netsvc, tools, os, time
93     data_dict = {'model': 'account.account', 'form': {'chart_account_id':ref('account.chart0'),'select_account': False,'display_account':'bal_all','format_perc':0,'filter': 'filter_no','show_columns' :0, 'account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': ref('account.data_fiscalyear') ,'target_move': 'all','periods': [],'id':ref('account.bal'),'context':{'state':'all'}}}
94     (data, format) = netsvc.LocalService('report.account.account.balance').create(cr, uid, [ref('account.bal'),ref('account.gpf')], data_dict, {'periods': []})
95     if tools.config['test_report_directory']:
96        file(os.path.join(tools.config['test_report_directory'], 'account-account_balance-normal.'+format), 'wb+').write(data)
97
98     data_dict.update({'model': 'ir.ui.menu'})
99     data_dict['form'].update({'active_ids':[ref('account.bal'),ref('account.gpf')]})
100
101     (data, format) = netsvc.LocalService('report.account.account.balance').create(cr, uid, [], data_dict, {'periods': []})
102     if tools.config['test_report_directory']:
103        file(os.path.join(tools.config['test_report_directory'], 'account-account_balance-normal-menu.'+format), 'wb+').write(data)
104
105 -
106   Print the Central Journal Report - From Account
107 -
108   !python {model: account.journal.period}: |
109     import netsvc, tools, os, time
110     fy_id = ref('account.data_fiscalyear')
111     period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
112     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     journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context)
114
115     obj_move = self.pool.get('account.move.line')
116     ctx = {}
117     ctx['fiscalyear'] = fy_id
118     ctx['journal_ids'] = journal_ids
119     ctx['chart_account_id'] = ref('account.chart0')
120
121     query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
122     data_dict = {'model': 'account.journal.period', 'id':journal_period_ids[0], 'form': {'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }}
123     (data, format) = netsvc.LocalService('report.account.central.journal').create(cr, uid, journal_period_ids, data_dict, {})
124     if tools.config['test_report_directory']:
125        file(os.path.join(tools.config['test_report_directory'], 'account-central_journal.'+format), 'wb+').write(data)
126
127     data_dict.update({'model': 'ir.ui.menu'})
128     data_dict['form'].update({'active_ids':journal_period_ids})
129
130     (data, format) = netsvc.LocalService('report.account.central.journal').create(cr, uid, [], data_dict, {})
131     if tools.config['test_report_directory']:
132        file(os.path.join(tools.config['test_report_directory'], 'account-central_journal-menu.'+format), 'wb+').write(data)
133 -
134   Print the General Journal Report - From Journal
135 -
136   !python {model: account.journal.period}: |
137     import netsvc, tools, os, time
138     fy_id = ref('account.data_fiscalyear')
139     period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
140     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')]
141     journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context)
142
143     obj_move = self.pool.get('account.move.line')
144     ctx = {}
145     ctx['fiscalyear'] = fy_id
146     ctx['journal_ids'] = journal_ids
147     ctx['chart_account_id'] = ref('account.chart0')
148
149     query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
150     data_dict = {'model': 'ir.ui.menu','id':journal_period_ids[0], 'form': {'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids, 'active_ids':journal_period_ids}}
151     (data, format) = netsvc.LocalService('report.account.general.journal').create(cr, uid, journal_period_ids, data_dict, {})
152     if tools.config['test_report_directory']:
153        file(os.path.join(tools.config['test_report_directory'], 'account-general_journal.'+format), 'wb+').write(data)
154
155 -
156   Print the General Ledger Report in Normal Mode
157 -
158   !python {model: account.account}: |
159     import netsvc, tools, os, time
160     fy_id = ref('account.data_fiscalyear')
161     period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
162     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')]
163     acc_ids = [ref('account.bal'),ref('account.gpf')]
164
165     obj_move = self.pool.get('account.move.line')
166     ctx = {}
167     ctx['fiscalyear'] = fy_id
168     ctx['journal_ids'] = journal_ids
169     ctx['chart_account_id'] = ref('account.chart0')
170
171     query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
172
173     data_dict = {'model': 'account.account', 'form': {'initial_balance': 1,'initial_bal_query': query_line,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','sortby': 'sort_date','amount_currency': 0,'landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }}
174     (data, format) = netsvc.LocalService('report.account.general.ledger').create(cr, uid, acc_ids, data_dict, {})
175     if tools.config['test_report_directory']:
176        file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger.'+format), 'wb+').write(data)
177
178     data_dict.update({'model': 'ir.ui.menu'})
179     data_dict['form'].update({'active_ids': acc_ids})
180     (data, format) = netsvc.LocalService('report.account.general.ledger').create(cr, uid, [], data_dict, {})
181     if tools.config['test_report_directory']:
182        file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger-menu.'+format), 'wb+').write(data)
183 -
184   Print the General Ledger Report in Landscape Mode
185 -
186   !python {model: account.account}: |
187     import netsvc, tools, os, time
188     fy_id = ref('account.data_fiscalyear')
189     period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
190     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')]
191     acc_ids = [ref('account.bal'),ref('account.gpf')]
192
193     obj_move = self.pool.get('account.move.line')
194     ctx = {}
195     ctx['fiscalyear'] = fy_id
196     ctx['journal_ids'] = journal_ids
197     ctx['chart_account_id'] = ref('account.chart0')
198
199     query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
200
201     data_dict = {'model': 'account.account', 'form': {'initial_balance': 1,'initial_bal_query':query_line,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','sortby': 'sort_date','amount_currency': 0,'landscape':1,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }}
202     (data, format) = netsvc.LocalService('report.account.general.ledger_landscape').create(cr, uid, acc_ids, data_dict, {})
203     if tools.config['test_report_directory']:
204        file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger-landscape.'+format), 'wb+').write(data)
205
206     data_dict.update({'model': 'ir.ui.menu'})
207     data_dict['form'].update({'active_ids': acc_ids})
208     (data, format) = netsvc.LocalService('report.account.general.ledger_landscape').create(cr, uid, [], data_dict, {})
209     if tools.config['test_report_directory']:
210        file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger-landscape-menu.'+format), 'wb+').write(data)
211
212 -
213   Print Journal Report - From Model
214 -
215   !python {model: account.journal.period}: |
216     import netsvc, tools, os, time
217     fy_id = ref('account.data_fiscalyear')
218     period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
219     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')]
220     journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context)
221
222     obj_move = self.pool.get('account.move.line')
223     ctx = {}
224     ctx['fiscalyear'] = fy_id
225     ctx['journal_ids'] = journal_ids
226     ctx['chart_account_id'] = ref('account.chart0')
227
228     query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
229
230     data_dict = {'model': 'account.journal.period', 'id':journal_period_ids[0], 'form': {'sort_selection': 'date','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }}
231     (data, format) = netsvc.LocalService('report.account.journal.period.print').create(cr, uid, journal_period_ids, data_dict, {})
232     if tools.config['test_report_directory']:
233        file(os.path.join(tools.config['test_report_directory'], 'account-print_journal.'+format), 'wb+').write(data)
234
235     data_dict.update({'model': 'ir.ui.menu'})
236     data_dict['form'].update({'active_ids':journal_period_ids})
237
238     (data, format) = netsvc.LocalService('report.account.journal.period.print').create(cr, uid, [], data_dict, {})
239     if tools.config['test_report_directory']:
240        file(os.path.join(tools.config['test_report_directory'], 'account-print_journal-menu.'+format), 'wb+').write(data)
241
242 -
243   Print the Partner Balance Report
244 -
245   !python {model: res.partner}: |
246     import netsvc, tools, os, time
247     fy_id = ref('account.data_fiscalyear')
248     period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
249     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')]
250     journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context)
251     obj_move = self.pool.get('account.move.line')
252     ctx = {}
253     ctx['fiscalyear'] = fy_id
254     ctx['journal_ids'] = journal_ids
255     ctx['chart_account_id'] = ref('account.chart0')
256
257     query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
258
259     data_dict = {'model': 'ir.ui.menu', 'form': {'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'active_ids':journal_period_ids,'display_partner': 'all','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}}
260     (data, format) = netsvc.LocalService('report.account.partner.balance').create(cr, uid, journal_period_ids, data_dict, {})
261     if tools.config['test_report_directory']:
262        file(os.path.join(tools.config['test_report_directory'], 'account-partner_balance.'+format), 'wb+').write(data)
263
264 -
265   Print the Partner Ledger Report
266 -
267   !python {model: res.partner}: |
268     import netsvc, tools, os, time
269     fy_id = ref('account.data_fiscalyear')
270     period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
271     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')]
272
273     obj_move = self.pool.get('account.move.line')
274     ctx = {}
275     ctx['fiscalyear'] = fy_id
276     ctx['journal_ids'] = journal_ids
277     ctx['chart_account_id'] = ref('account.chart0')
278
279     query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
280
281     data_dict = {'model': 'ir.ui.menu', 'form': {'initial_bal_query':query_line,'amount_currency': 0,'reconcil': True,'initial_balance':1,'page_split': True,'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'display_partner': 'non-zero_balance','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}}
282     (data, format) = netsvc.LocalService('report.account.third_party_ledger').create(cr, uid, [], data_dict, {})
283     if tools.config['test_report_directory']:
284        file(os.path.join(tools.config['test_report_directory'], 'account-partner_ledger.'+format), 'wb+').write(data)
285
286 -
287   Print the Partner Ledger-Other Report
288 -
289   !python {model: res.partner}: |
290     import netsvc, tools, os, time
291     fy_id = ref('account.data_fiscalyear')
292     period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
293     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')]
294
295     obj_move = self.pool.get('account.move.line')
296     ctx = {}
297     ctx['fiscalyear'] = fy_id
298     ctx['journal_ids'] = journal_ids
299     ctx['chart_account_id'] = ref('account.chart0')
300
301     query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
302     data_dict = {'model': 'ir.ui.menu', 'form': {'initial_bal_query':query_line,'amount_currency': 0,'reconcil': True,'initial_balance':1,'page_split': False,'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'display_partner': 'non-zero_balance','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}}
303     (data, format) = netsvc.LocalService('report.account.third_party_ledger_other').create(cr, uid, [], data_dict, {})
304     if tools.config['test_report_directory']:
305        file(os.path.join(tools.config['test_report_directory'], 'account-partner_ledger-other.'+format), 'wb+').write(data)
306
307 -
308   Print the Profit-Loss Report in Normal Mode
309 -
310   !python {model: account.account}: |
311     import netsvc, tools, os, time
312     fy_id = ref('account.data_fiscalyear')
313     period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
314     journal_ids = []
315     acc_ids = [ref('account.bal'),ref('account.gpf')]
316     data_dict = {'model': 'ir.ui.menu', 'form': {'display_type': False,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':'True ','target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal'),'active_ids':acc_ids }}
317     (data, format) = netsvc.LocalService('report.pl.account').create(cr, uid, [], data_dict, {})
318     if tools.config['test_report_directory']:
319        file(os.path.join(tools.config['test_report_directory'], 'account-profit-loss.'+format), 'wb+').write(data)
320
321 -
322   Print the Profit-Loss Report in Horizontal Mode
323 -
324   !python {model: account.account}: |
325     import netsvc, tools, os, time
326     fy_id = ref('account.data_fiscalyear')
327     period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
328     journal_ids = []
329     acc_ids = [ref('account.bal'),ref('account.gpf')]
330     data_dict = {'model': 'ir.ui.menu', 'form': {'display_type': True,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':'True ','target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal'),'active_ids':acc_ids }}
331     (data, format) = netsvc.LocalService('report.pl.account.horizontal').create(cr, uid, [], data_dict, {})
332     if tools.config['test_report_directory']:
333        file(os.path.join(tools.config['test_report_directory'], 'account-profit-loss-horizontal.'+format), 'wb+').write(data)