[IMP]:improved code
bzr revid: apa@tinyerp.com-20101222091844-2zcr2sanompfzw2n
This commit is contained in:
parent
1aca8bc410
commit
63a18c1ee5
|
@ -28,7 +28,6 @@
|
|||
(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')], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data)
|
||||
|
||||
-
|
||||
In order to test the PDF reports defined on Account Move, we will print the Voucher Report
|
||||
-
|
||||
|
@ -37,56 +36,22 @@
|
|||
(data, format) = netsvc.LocalService('report.account.move.voucher').create(cr, uid, [ref('account.account_move_0')], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account-voucher-report.'+format), 'wb+').write(data)
|
||||
|
||||
-
|
||||
Print the Aged Partner Balance Report
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
import time
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
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 = {}
|
||||
for i in range(5)[::-1]:
|
||||
stop = start - relativedelta(days=30)
|
||||
res[str(i)] = {
|
||||
'name': (i!=0 and (str((5-(i+1)) * 30) + '-' + str((5-i) * 30)) or ('+'+str(4 * 30))),
|
||||
'stop': start.strftime('%Y-%m-%d'),
|
||||
'start': (i!=0 and stop.strftime('%Y-%m-%d') or False),
|
||||
}
|
||||
start = stop - relativedelta(days=1)
|
||||
obj_move = self.pool.get('account.move.line')
|
||||
ctx = {}
|
||||
fy_id = ref('account.data_fiscalyear')
|
||||
period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
|
||||
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')]
|
||||
ctx['fiscalyear'] = fy_id
|
||||
ctx['journal_ids'] = journal_ids
|
||||
ctx['chart_account_id'] = ref('account.chart0')
|
||||
|
||||
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['form'].update(res)
|
||||
from tools.test_reports import try_report
|
||||
try_report(cr, uid, 'report.account.aged_trial_balance', [], data_dict, context={})
|
||||
!python {model: account.account}: |
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
|
||||
data_dict = {'chart_account_id':ref('account.chart0')}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_aged_balance_view',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
Print the Account Balance Sheet in Horizontal mode
|
||||
-
|
||||
!python {model: account.account}: |
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'fiscalyear_id':ref('account.data_fiscalyear'),'display_account':'bal_all','target_move': 'all',
|
||||
'display_type': True}
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'display_type': True}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_bs_report',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
|
@ -95,8 +60,7 @@
|
|||
!python {model: account.account}: |
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'fiscalyear_id':ref('account.data_fiscalyear'),'display_account':'bal_all','target_move': 'all',
|
||||
'display_type': False}
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_bs_report',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
|
@ -105,137 +69,93 @@
|
|||
!python {model: account.account}: |
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'fiscalyear_id':ref('account.data_fiscalyear'),'target_move': 'all','display_account':'bal_all'}
|
||||
data_dict = {'chart_account_id':ref('account.chart0')}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_balance_menu',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
Print the Central Journal Report - From Account
|
||||
-
|
||||
!python {model: account.journal.period}: |
|
||||
journal_ids = [(6,0,[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')])]
|
||||
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')]
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.journal.period','active_ids':journal_ids[0][2]})
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'fiscalyear_id':ref('account.data_fiscalyear'),'journal_ids':journal_ids,'target_move': 'all'}
|
||||
ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
|
||||
data_dict = {'chart_account_id':ref('account.chart0')}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_central_journal',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
Print the General Journal Report - From Journal
|
||||
-
|
||||
!python {model: account.journal.period}: |
|
||||
journal_ids = [(6,0,[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')])]
|
||||
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')]
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.journal.period','active_ids':journal_ids[0][2]})
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'fiscalyear_id':ref('account.data_fiscalyear'),'journal_ids':journal_ids,'target_move': 'all'}
|
||||
ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
|
||||
data_dict = {'chart_account_id':ref('account.chart0')}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_general_journal',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
Print the General Ledger Report in Normal Mode
|
||||
-
|
||||
!python {model: account.account}: |
|
||||
journal_ids = [(6,0,[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')])]
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
|
||||
data_dict = {'initial_balance': True,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','sortby': 'sort_date',
|
||||
'amount_currency': False,'landscape':False,'fiscalyear_id': ref('account.data_fiscalyear'),'target_move': 'all','journal_ids':journal_ids }
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'landscape':False}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
Print the General Ledger Report in Landscape Mode
|
||||
-
|
||||
!python {model: account.account}: |
|
||||
journal_ids = [(6,0,[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')])]
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
|
||||
data_dict = {'initial_balance': True,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','sortby': 'sort_date',
|
||||
'amount_currency': False,'landscape':True,'fiscalyear_id': ref('account.data_fiscalyear'),'target_move': 'all','journal_ids':journal_ids }
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'landscape':True}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
Print Journal Report - From Model
|
||||
-
|
||||
!python {model: account.journal.period}: |
|
||||
journal_ids = [(6,0,[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')])]
|
||||
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')]
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.journal.period','active_ids':journal_ids[0][2]})
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'fiscalyear_id':ref('account.data_fiscalyear'),'journal_ids':journal_ids,'target_move': 'all'}
|
||||
ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
|
||||
data_dict = {'chart_account_id':ref('account.chart0')}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_print_journal',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
Print the Partner Balance Report
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
import netsvc, tools, os, time
|
||||
fy_id = ref('account.data_fiscalyear')
|
||||
period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
|
||||
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')]
|
||||
journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context)
|
||||
obj_move = self.pool.get('account.move.line')
|
||||
ctx = {}
|
||||
ctx['fiscalyear'] = fy_id
|
||||
ctx['journal_ids'] = journal_ids
|
||||
ctx['chart_account_id'] = ref('account.chart0')
|
||||
|
||||
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
||||
|
||||
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}}
|
||||
(data, format) = netsvc.LocalService('report.account.partner.balance').create(cr, uid, journal_period_ids, data_dict, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account-partner_balance.'+format), 'wb+').write(data)
|
||||
|
||||
!python {model: account.account}: |
|
||||
ctx={}
|
||||
data_dict = {'chart_account_id':ref('account.chart0')}
|
||||
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_partner_balance',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
Print the Partner Ledger Report
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
import netsvc, tools, os, time
|
||||
fy_id = ref('account.data_fiscalyear')
|
||||
period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
|
||||
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')]
|
||||
|
||||
obj_move = self.pool.get('account.move.line')
|
||||
ctx = {}
|
||||
ctx['fiscalyear'] = fy_id
|
||||
ctx['journal_ids'] = journal_ids
|
||||
ctx['chart_account_id'] = ref('account.chart0')
|
||||
|
||||
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
||||
|
||||
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}}
|
||||
(data, format) = netsvc.LocalService('report.account.third_party_ledger').create(cr, uid, [], data_dict, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account-partner_ledger.'+format), 'wb+').write(data)
|
||||
|
||||
!python {model: account.account}: |
|
||||
ctx={}
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'page_split': True}
|
||||
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
Print the Partner Ledger-Other Report
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
import netsvc, tools, os, time
|
||||
fy_id = ref('account.data_fiscalyear')
|
||||
period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
|
||||
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')]
|
||||
|
||||
obj_move = self.pool.get('account.move.line')
|
||||
ctx = {}
|
||||
ctx['fiscalyear'] = fy_id
|
||||
ctx['journal_ids'] = journal_ids
|
||||
ctx['chart_account_id'] = ref('account.chart0')
|
||||
|
||||
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
||||
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}}
|
||||
(data, format) = netsvc.LocalService('report.account.third_party_ledger_other').create(cr, uid, [], data_dict, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account-partner_ledger-other.'+format), 'wb+').write(data)
|
||||
|
||||
ctx={}
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'page_split': False}
|
||||
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
Print the Profit-Loss Report in Normal Mode
|
||||
-
|
||||
!python {model: account.account}: |
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'fiscalyear_id':ref('account.data_fiscalyear'),'display_account':'bal_all','display_type': False}
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_pl_report',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
|
@ -244,6 +164,6 @@
|
|||
!python {model: account.account}: |
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'fiscalyear_id':ref('account.data_fiscalyear'),'display_account':'bal_all','display_type': True}
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'display_type': True}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_pl_report',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
|
|
Loading…
Reference in New Issue