diff --git a/addons/hr_timesheet/__openerp__.py b/addons/hr_timesheet/__openerp__.py index 5a2e37353cd..90ddc25fff6 100644 --- a/addons/hr_timesheet/__openerp__.py +++ b/addons/hr_timesheet/__openerp__.py @@ -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, diff --git a/addons/hr_timesheet/test/hr_timesheet_report.yml b/addons/hr_timesheet/test/hr_timesheet_report.yml index 04c07d77403..811858eb7f2 100644 --- a/addons/hr_timesheet/test/hr_timesheet_report.yml +++ b/addons/hr_timesheet/test/hr_timesheet_report.yml @@ -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) \ No newline at end of file diff --git a/addons/hr_timesheet_invoice/__openerp__.py b/addons/hr_timesheet_invoice/__openerp__.py index df44302ec56..f45490867c2 100644 --- a/addons/hr_timesheet_invoice/__openerp__.py +++ b/addons/hr_timesheet_invoice/__openerp__.py @@ -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, diff --git a/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml b/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml index 118699c4aa3..ecdd486a65e 100644 --- a/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml +++ b/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml @@ -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) \ No newline at end of file + file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet_invoice-cost_ledger_report.'+format), 'wb+').write(data)