account/test: simplify Aged Partner Balance report, reduce imports
It has been importing md5, hashlib, warnings, netsvc and tools, which are not really appropriate for testing code. Instead, port to the "test_reports" testing helper. The rest of the file needs to be ported, too. TODO. bzr revid: p_christ@hol.gr-20101127201630-zaaowb4oaoxvxlv1
This commit is contained in:
parent
c9bb11b2f1
commit
61560695f4
|
@ -42,13 +42,9 @@
|
|||
Print the Aged Partner Balance Report
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
import netsvc, tools, os, time
|
||||
import time
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import warnings
|
||||
import md5
|
||||
import hashlib
|
||||
warnings.filterwarnings('ignore',".*struct integer overflow masking is deprecated*")
|
||||
start = datetime.fromtimestamp(time.mktime(time.strptime(time.strftime('%Y-%m-%d'), "%Y-%m-%d")))
|
||||
start = datetime(int(start.year), int(start.month), int(start.day))
|
||||
res = {}
|
||||
|
@ -71,12 +67,18 @@
|
|||
|
||||
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
||||
|
||||
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}}
|
||||
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 } }
|
||||
data_dict['form'].update(res)
|
||||
(data, format) = netsvc.LocalService('report.account.aged_trial_balance').create(cr, uid, [], data_dict, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account-aged_partner_balance.'+format), 'wb+').write(data)
|
||||
|
||||
from tools.test_reports import try_report
|
||||
try_report(cr, uid, 'report.account.aged_trial_balance', [], data_dict, context={})
|
||||
-
|
||||
Print the Account Balance Sheet in Horizontal mode
|
||||
-
|
||||
|
|
Loading…
Reference in New Issue