[FIX] Hr_timesheet,hr_timesheet_invoice : YML test corrections

bzr revid: jvo@tinyerp.com-20100917142323-737yl8uiblz2mzc7
This commit is contained in:
Jay (OpenERP) 2010-09-17 19:53:23 +05:30
parent 8cfba5e4ab
commit 56eed34030
4 changed files with 20 additions and 31 deletions

View File

@ -51,7 +51,7 @@ to set up a management by affair.
],
'demo_xml': ['hr_timesheet_demo.xml'],
'test': ['test/test_hr_timesheet.yml',
'test/hr_timesheet_invoice_report.yml',
'test/hr_timesheet_report.yml',
],
'installable': True,
'active': False,

View File

@ -1,31 +1,23 @@
-
In order to test the PDF reports defined on a HR Timesheet User Report, we will print a HR Timesheet User Report
In order to test the PDF reports defined on HR Timesheet User Report, we will print a HR Timesheet User Report
-
!python {model: hr.employee}: |
import netsvc, tools, os, time
import datetime
from mx.DateTime import *
start = datetime.date.fromtimestamp(time.mktime(time.strptime(time.strftime('%Y-%m-%d'), "%Y-%m-%d")))
start = DateTime(int(start.year), int(start.month), int(start.day))
month=start.month
year=start.year
data_dict = {'model': 'ir.ui.menu', 'form': {'month': month, 'year' : year, 'user_id' : ref('base.user_root') }}
(data, format) = netsvc.LocalService('report.hr.analytical.timesheet').create(cr, uid, [], data_dict, {'periods': []})
month = time.gmtime()[1]
year = time.gmtime()[0]
data_dict = {'model': 'ir.ui.menu', 'form': {'month': month, 'year' : year, 'user_id' : uid }}
(data, format) = netsvc.LocalService('report.hr.analytical.timesheet').create(cr, uid, [], data_dict, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet-user_report.'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a HR Timesheet Users Report, we will print a HR Timesheet Users Report
In order to test the PDF reports defined on HR Timesheet Users Report, we will print a HR Timesheet Users Report
-
!python {model: hr.employee}: |
import netsvc, tools, os, time
import datetime
from mx.DateTime import *
start = datetime.date.fromtimestamp(time.mktime(time.strptime(time.strftime('%Y-%m-%d'), "%Y-%m-%d")))
start = DateTime(int(start.year), int(start.month), int(start.day))
month=start.month
year=start.year
data_dict = {'model': 'ir.ui.menu', 'form': {'month': month, 'year' : year, 'user_ids' : [ref('base.user_root')] }}
(data, format) = netsvc.LocalService('report.hr.analytical.timesheet_users').create(cr, uid, [], data_dict, {'periods': []})
month = time.gmtime()[1]
year = time.gmtime()[0]
data_dict = {'model': 'ir.ui.menu', 'form': {'month': month, 'year' : year, 'user_ids' : [uid] }}
(data, format) = netsvc.LocalService('report.hr.analytical.timesheet_users').create(cr, uid, [], data_dict, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet-users_report.'+format), 'wb+').write(data)

View File

@ -47,7 +47,7 @@ reports, eso.""",
],
'demo_xml': ['hr_timesheet_invoice_demo.xml',
],
'test': ['test/test_hr_timesheet_invoice.yml'
'test': ['test/test_hr_timesheet_invoice.yml',
'test/hr_timesheet_invoice_report.yml',
],
'installable': True,

View File

@ -1,23 +1,20 @@
-
In order to test the PDF reports defined on a HR Timesheet Account Analytic Profit, we will print a HR Timesheet Account Analytic Profit
In order to test the PDF reports defined on HR Timesheet Account Analytic Profit, we will print report of HR Timesheet Account Analytic Profit
-
!python {model: account.analytic.line}: |
import netsvc, tools, os, time
data_dict = {'model': 'ir.ui.menu', 'form': {'date_from': '2010-09-01', 'employee_ids': [[6, 0, [1, ref('hr.employee2')]]], 'journal_ids': [[6, 0, [1, 2, 3, 4]]], 'date_to': '2010-09-16'}}
(data, format) = netsvc.LocalService('report.account.analytic.profit').create(cr, uid, [], data_dict, {'periods': []})
data_dict = {'model': 'ir.ui.menu', 'form': {'date_from': time.strftime('%Y-%m-01'), 'employee_ids': [[6,0,[ref('hr.employee1'), ref('hr.employee2'),ref('hr.employee3')]]], 'journal_ids': [[6,0,[ref('account.cose_journal_sale'),ref('account.exp'),ref('account.sit')]]], 'date_to': time.strftime('%Y-%m-%d')}}
(data, format) = netsvc.LocalService('report.account.analytic.profit').create(cr, uid, [], data_dict, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet_invoice-account_analytic_profit_report.'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a HR Cost Ledger, we will print a HR Cost Ledger
In order to test the PDF reports defined on HR Cost Ledger, we will print report of HR Cost Ledger
-
!python {model: account.analytic.account}: |
import netsvc, tools, os, time
import datetime
from mx.DateTime import *
start = datetime.date.fromtimestamp(time.mktime(time.strptime(time.strftime('%Y-%m-%d'), "%Y-%m-%d")))
start = DateTime(int(start.year), int(start.month), int(start.day))
data_dict = {'model': 'ir.ui.menu', 'form': {'date1': start.strftime('%Y-%m-%d'), 'date2': start.strftime('%Y-%m-%d')}}
(data, format) = netsvc.LocalService('report.hr.timesheet.invoice.account.analytic.account.cost_ledger').create(cr, uid, [], data_dict, {'periods': []})
acc_ids = [ref('account.analytic_absences'),ref('account.analytic_internal'),ref('account.analytic_sednacom'),ref('account.analytic_thymbra'),ref('account.analytic_partners_camp_to_camp')]
data_dict = {'model': 'ir.ui.menu', 'form': {'date1': time.strftime('%Y-01-01'), 'date2': time.strftime('%Y-%m-%d')}}
(data, format) = netsvc.LocalService('report.hr.timesheet.invoice.account.analytic.account.cost_ledger').create(cr, uid, acc_ids, data_dict, {'active_ids': acc_ids})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet_invoice-cost_ledger_report.'+format), 'wb+').write(data)
file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet_invoice-cost_ledger_report.'+format), 'wb+').write(data)