2010-10-19 11:14:23 +00:00
|
|
|
-
|
|
|
|
In order to test the PDF reports defined on an invoice, we will create a Invoice Record
|
|
|
|
-
|
|
|
|
!record {model: account.invoice, id: test_invoice_1}:
|
2010-10-27 12:44:06 +00:00
|
|
|
currency_id: base.EUR
|
2010-10-19 11:14:23 +00:00
|
|
|
company_id: base.main_company
|
|
|
|
address_invoice_id: base.res_partner_address_tang
|
|
|
|
partner_id: base.res_partner_asus
|
|
|
|
state: draft
|
|
|
|
type: out_invoice
|
|
|
|
account_id: account.a_recv
|
|
|
|
name: Test invoice 1
|
|
|
|
address_contact_id: base.res_partner_address_tang
|
2010-09-15 12:15:34 +00:00
|
|
|
-
|
2010-09-27 17:53:35 +00:00
|
|
|
In order to test the PDF reports defined on an invoice, we will print an Invoice Report
|
2010-10-11 11:28:45 +00:00
|
|
|
-
|
2010-09-15 12:15:34 +00:00
|
|
|
!python {model: account.invoice}: |
|
|
|
|
import netsvc, tools, os
|
2010-10-28 07:13:17 +00:00
|
|
|
(data, format) = netsvc.LocalService('report.account.invoice').create(cr, uid, [ref('account.account_invoice_customer0')], {}, {})
|
2010-09-15 12:15:34 +00:00
|
|
|
if tools.config['test_report_directory']:
|
2010-09-16 05:40:15 +00:00
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
|
|
|
|
|
2010-09-15 12:15:34 +00:00
|
|
|
-
|
2010-09-16 05:40:15 +00:00
|
|
|
In order to test the PDF reports defined on a partner, we will print the Overdue Report
|
2010-10-11 11:28:45 +00:00
|
|
|
-
|
2010-09-15 12:15:34 +00:00
|
|
|
!python {model: res.partner}: |
|
|
|
|
import netsvc, tools, os
|
2010-09-16 16:38:39 +00:00
|
|
|
(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')], {}, {})
|
2010-09-15 12:15:34 +00:00
|
|
|
if tools.config['test_report_directory']:
|
2010-09-16 05:40:15 +00:00
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data)
|
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
-
|
|
|
|
In order to test the PDF reports defined on Account Move, we will print the Voucher Report
|
2010-10-11 11:28:45 +00:00
|
|
|
-
|
2010-09-16 21:27:23 +00:00
|
|
|
!python {model: account.move}: |
|
|
|
|
import netsvc, tools, os
|
|
|
|
(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)
|
|
|
|
|
2010-09-16 05:40:15 +00:00
|
|
|
-
|
|
|
|
Print the Aged Partner Balance Report
|
|
|
|
-
|
|
|
|
!python {model: res.partner}: |
|
2010-11-27 20:16:30 +00:00
|
|
|
import time
|
2010-10-18 11:56:15 +00:00
|
|
|
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))
|
2010-09-16 05:40:15 +00:00
|
|
|
res = {}
|
|
|
|
for i in range(5)[::-1]:
|
2010-10-18 11:56:15 +00:00
|
|
|
stop = start - relativedelta(days=30)
|
2010-09-16 05:40:15 +00:00
|
|
|
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),
|
|
|
|
}
|
2010-10-18 11:56:15 +00:00
|
|
|
start = stop - relativedelta(days=1)
|
2010-09-16 21:27:23 +00:00
|
|
|
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')
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-11-27 20:16:30 +00:00
|
|
|
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 } }
|
2010-09-16 05:40:15 +00:00
|
|
|
data_dict['form'].update(res)
|
2010-11-27 20:16:30 +00:00
|
|
|
from tools.test_reports import try_report
|
|
|
|
try_report(cr, uid, 'report.account.aged_trial_balance', [], data_dict, context={})
|
2010-09-16 08:33:41 +00:00
|
|
|
-
|
2010-09-16 21:27:23 +00:00
|
|
|
Print the Account Balance Sheet in Horizontal mode
|
2010-09-16 10:49:35 +00:00
|
|
|
-
|
|
|
|
!python {model: account.account}: |
|
|
|
|
|
2010-12-21 12:26:21 +00:00
|
|
|
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}
|
|
|
|
|
|
|
|
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')
|
2010-09-16 10:49:35 +00:00
|
|
|
-
|
|
|
|
Print the Account Balance Sheet in Normal mode
|
2010-09-16 08:33:41 +00:00
|
|
|
-
|
|
|
|
!python {model: account.account}: |
|
2010-09-16 10:49:35 +00:00
|
|
|
|
2010-12-21 12:26:21 +00:00
|
|
|
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}
|
|
|
|
|
|
|
|
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')
|
2010-09-16 10:49:35 +00:00
|
|
|
-
|
2010-12-20 13:23:37 +00:00
|
|
|
Print the Account Balance Report in Normal mode through the wizard - From Account Chart
|
2010-09-16 10:49:35 +00:00
|
|
|
-
|
|
|
|
!python {model: account.account}: |
|
|
|
|
import netsvc, tools, os, time
|
2010-12-20 13:23:37 +00:00
|
|
|
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'}
|
|
|
|
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')
|
2010-09-16 12:05:21 +00:00
|
|
|
-
|
2010-09-16 14:44:14 +00:00
|
|
|
Print the Central Journal Report - From Account
|
2010-09-16 12:05:21 +00:00
|
|
|
-
|
|
|
|
!python {model: account.journal.period}: |
|
|
|
|
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)
|
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
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')
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
|
|
|
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') }}
|
2010-09-16 12:05:21 +00:00
|
|
|
(data, format) = netsvc.LocalService('report.account.central.journal').create(cr, uid, journal_period_ids, data_dict, {})
|
|
|
|
if tools.config['test_report_directory']:
|
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-central_journal.'+format), 'wb+').write(data)
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 14:44:14 +00:00
|
|
|
data_dict.update({'model': 'ir.ui.menu'})
|
|
|
|
data_dict['form'].update({'active_ids':journal_period_ids})
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 14:44:14 +00:00
|
|
|
(data, format) = netsvc.LocalService('report.account.central.journal').create(cr, uid, [], data_dict, {})
|
|
|
|
if tools.config['test_report_directory']:
|
2010-09-16 15:21:11 +00:00
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-central_journal-menu.'+format), 'wb+').write(data)
|
2010-09-16 14:44:14 +00:00
|
|
|
-
|
|
|
|
Print the General Journal Report - From Journal
|
|
|
|
-
|
|
|
|
!python {model: account.journal.period}: |
|
|
|
|
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)
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
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')
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
|
|
|
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}}
|
2010-09-16 14:44:14 +00:00
|
|
|
(data, format) = netsvc.LocalService('report.account.general.journal').create(cr, uid, journal_period_ids, data_dict, {})
|
|
|
|
if tools.config['test_report_directory']:
|
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-general_journal.'+format), 'wb+').write(data)
|
2010-09-16 12:05:21 +00:00
|
|
|
|
2010-09-16 14:44:14 +00:00
|
|
|
-
|
|
|
|
Print the General Ledger Report in Normal Mode
|
|
|
|
-
|
|
|
|
!python {model: account.account}: |
|
|
|
|
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')]
|
|
|
|
acc_ids = [ref('account.bal'),ref('account.gpf')]
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
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')
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
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') }}
|
2010-09-16 14:44:14 +00:00
|
|
|
(data, format) = netsvc.LocalService('report.account.general.ledger').create(cr, uid, acc_ids, data_dict, {})
|
|
|
|
if tools.config['test_report_directory']:
|
2010-09-16 15:21:11 +00:00
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger.'+format), 'wb+').write(data)
|
2010-09-16 12:05:21 +00:00
|
|
|
|
2010-09-16 14:44:14 +00:00
|
|
|
data_dict.update({'model': 'ir.ui.menu'})
|
|
|
|
data_dict['form'].update({'active_ids': acc_ids})
|
|
|
|
(data, format) = netsvc.LocalService('report.account.general.ledger').create(cr, uid, [], data_dict, {})
|
|
|
|
if tools.config['test_report_directory']:
|
2010-09-16 15:21:11 +00:00
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger-menu.'+format), 'wb+').write(data)
|
2010-09-16 14:44:14 +00:00
|
|
|
-
|
|
|
|
Print the General Ledger Report in Landscape Mode
|
|
|
|
-
|
|
|
|
!python {model: account.account}: |
|
|
|
|
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')]
|
|
|
|
acc_ids = [ref('account.bal'),ref('account.gpf')]
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
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')
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
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') }}
|
2010-09-16 14:44:14 +00:00
|
|
|
(data, format) = netsvc.LocalService('report.account.general.ledger_landscape').create(cr, uid, acc_ids, data_dict, {})
|
|
|
|
if tools.config['test_report_directory']:
|
2010-09-16 15:21:11 +00:00
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger-landscape.'+format), 'wb+').write(data)
|
2010-09-16 14:44:14 +00:00
|
|
|
|
|
|
|
data_dict.update({'model': 'ir.ui.menu'})
|
|
|
|
data_dict['form'].update({'active_ids': acc_ids})
|
|
|
|
(data, format) = netsvc.LocalService('report.account.general.ledger_landscape').create(cr, uid, [], data_dict, {})
|
|
|
|
if tools.config['test_report_directory']:
|
2010-09-16 15:21:11 +00:00
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-general_ledger-landscape-menu.'+format), 'wb+').write(data)
|
|
|
|
|
|
|
|
-
|
|
|
|
Print Journal Report - From Model
|
|
|
|
-
|
|
|
|
!python {model: account.journal.period}: |
|
|
|
|
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)
|
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
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')
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
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') }}
|
2010-09-16 15:21:11 +00:00
|
|
|
(data, format) = netsvc.LocalService('report.account.journal.period.print').create(cr, uid, journal_period_ids, data_dict, {})
|
|
|
|
if tools.config['test_report_directory']:
|
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-print_journal.'+format), 'wb+').write(data)
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 15:21:11 +00:00
|
|
|
data_dict.update({'model': 'ir.ui.menu'})
|
|
|
|
data_dict['form'].update({'active_ids':journal_period_ids})
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 15:21:11 +00:00
|
|
|
(data, format) = netsvc.LocalService('report.account.journal.period.print').create(cr, uid, [], data_dict, {})
|
|
|
|
if tools.config['test_report_directory']:
|
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-print_journal-menu.'+format), 'wb+').write(data)
|
2010-09-16 12:05:21 +00:00
|
|
|
|
2010-09-16 15:21:11 +00:00
|
|
|
-
|
|
|
|
Print the Partner Balance Report
|
|
|
|
-
|
|
|
|
!python {model: res.partner}: |
|
|
|
|
import netsvc, tools, os, time
|
2010-09-16 21:27:23 +00:00
|
|
|
fy_id = ref('account.data_fiscalyear')
|
|
|
|
period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
|
2010-09-16 15:21:11 +00:00
|
|
|
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')]
|
2010-10-05 09:32:44 +00:00
|
|
|
journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context)
|
2010-09-16 21:27:23 +00:00
|
|
|
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')
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
2010-10-05 09:32:44 +00:00
|
|
|
|
|
|
|
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, {})
|
2010-09-16 15:21:11 +00:00
|
|
|
if tools.config['test_report_directory']:
|
|
|
|
file(os.path.join(tools.config['test_report_directory'], 'account-partner_balance.'+format), 'wb+').write(data)
|
2010-09-16 15:58:03 +00:00
|
|
|
|
|
|
|
-
|
|
|
|
Print the Partner Ledger Report
|
|
|
|
-
|
|
|
|
!python {model: res.partner}: |
|
|
|
|
import netsvc, tools, os, time
|
2010-09-16 21:27:23 +00:00
|
|
|
fy_id = ref('account.data_fiscalyear')
|
|
|
|
period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
|
2010-09-16 15:58:03 +00:00
|
|
|
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')]
|
2010-09-16 21:27:23 +00:00
|
|
|
|
|
|
|
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')
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
query_line = obj_move._query_get(cr, uid, obj='l', context=ctx)
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
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}}
|
2010-09-16 15:58:03 +00:00
|
|
|
(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)
|
|
|
|
|
|
|
|
-
|
|
|
|
Print the Partner Ledger-Other Report
|
|
|
|
-
|
|
|
|
!python {model: res.partner}: |
|
|
|
|
import netsvc, tools, os, time
|
2010-09-16 21:27:23 +00:00
|
|
|
fy_id = ref('account.data_fiscalyear')
|
|
|
|
period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context)
|
2010-09-16 15:58:03 +00:00
|
|
|
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')]
|
2010-09-16 21:27:23 +00:00
|
|
|
|
|
|
|
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')
|
2010-10-11 11:28:45 +00:00
|
|
|
|
2010-09-16 21:27:23 +00:00
|
|
|
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}}
|
2010-09-16 15:58:03 +00:00
|
|
|
(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)
|
|
|
|
|
|
|
|
-
|
|
|
|
Print the Profit-Loss Report in Normal Mode
|
|
|
|
-
|
|
|
|
!python {model: account.account}: |
|
2010-12-21 07:37:01 +00:00
|
|
|
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}
|
|
|
|
|
|
|
|
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')
|
2010-09-16 15:58:03 +00:00
|
|
|
-
|
|
|
|
Print the Profit-Loss Report in Horizontal Mode
|
|
|
|
-
|
|
|
|
!python {model: account.account}: |
|
2010-12-21 07:37:01 +00:00
|
|
|
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}
|
|
|
|
|
|
|
|
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')
|