diff --git a/addons/hr_attendance/__openerp__.py b/addons/hr_attendance/__openerp__.py index 18e585effc2..3714050cbdb 100644 --- a/addons/hr_attendance/__openerp__.py +++ b/addons/hr_attendance/__openerp__.py @@ -44,7 +44,7 @@ ], 'demo_xml': ['hr_attendance_demo.xml'], 'test': ['test/test_hr_attendance.yml', - 'test/hr_attendance_error_report.yml' + 'test/hr_attendance_report.yml' ], 'installable': True, 'active': False, diff --git a/addons/hr_attendance/test/hr_attendance_error_report.yml b/addons/hr_attendance/test/hr_attendance_error_report.yml deleted file mode 100644 index d7ca06587c7..00000000000 --- a/addons/hr_attendance/test/hr_attendance_error_report.yml +++ /dev/null @@ -1,29 +0,0 @@ -- - In order to test the PDF reports defined on a HR Attendance Error, we will print a HR Attendance Error -- - !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)) - data_dict = {'model': 'hr.employee', 'form': {'init_date': start.strftime('%Y-%m-%d'), 'end_date':start.strftime('%Y-%m-%d'), 'emp_ids': [ref('hr.employee2')], 'max_delay': 120}} - (data, format) = netsvc.LocalService('report.hr.attendance.error').create(cr, uid, [], data_dict, {'periods': []}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_attendance-error_report.'+format), 'wb+').write(data) - -- - In order to test the PDF reports defined on a HR Attendance By Month, we will print a HR Attendance By Month -- - !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"))) - year=start.year - month=start.month - start = DateTime(int(start.year), int(start.month), int(start.day)) - data_dict = {'model': 'ir.ui.menu', 'form': {'month': month, 'year': year }} - (data, format) = netsvc.LocalService('report.hr.attendance.bymonth').create(cr, uid, [], data_dict, {'active_ids': [ref('hr.employee2')]}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_attendance-by_month_report.'+format), 'wb+').write(data) \ No newline at end of file diff --git a/addons/hr_attendance/test/hr_attendance_report.yml b/addons/hr_attendance/test/hr_attendance_report.yml new file mode 100644 index 00000000000..d26f6ddb9bc --- /dev/null +++ b/addons/hr_attendance/test/hr_attendance_report.yml @@ -0,0 +1,19 @@ +- + In order to test the PDF reports defined on HR Attendance, we will print a report of HR Attendance By Month +- + !python {model: hr.employee}: | + import netsvc, tools, os, time + data_dict = {'model': 'hr.employee', 'form': {'month': time.gmtime()[1], 'year': time.gmtime()[0]}} + (data, format) = netsvc.LocalService('report.hr.attendance.bymonth').create(cr, uid, [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')], data_dict, {'active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]}) + if tools.config['test_report_directory']: + file(os.path.join(tools.config['test_report_directory'], 'hr_attendance-by_month_report.'+format), 'wb+').write(data) + +- + In order to test the PDF reports defined on HR Attendance, we will print a report of HR Attendance Error +- + !python {model: hr.employee}: | + import netsvc, tools, os, time + data_dict = {'model': 'hr.employee', 'form': {'init_date': time.strftime('%Y-01-01'), 'end_date':time.strftime('%Y-%m-%d'), 'emp_ids': [ref('hr.employee1')], 'max_delay': 120}} + (data, format) = netsvc.LocalService('report.hr.attendance.error').create(cr, uid, [ref('hr.employee1')], data_dict, {}) + if tools.config['test_report_directory']: + file(os.path.join(tools.config['test_report_directory'], 'hr_attendance-error_report.'+format), 'wb+').write(data) diff --git a/addons/hr_holidays/test/hr_holidays_report.yml b/addons/hr_holidays/test/hr_holidays_report.yml index fb8eb6319a0..9faf7358b53 100644 --- a/addons/hr_holidays/test/hr_holidays_report.yml +++ b/addons/hr_holidays/test/hr_holidays_report.yml @@ -1,13 +1,14 @@ - - In order to test the PDF reports defined on a HR Holidays, we will print a HR Holidays + In order to test the PDF reports defined on a HR Holidays, we will print HR Holidays - !python {model: hr.holidays}: | 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': {'date_from': start.strftime('%Y-%m-%d'), 'depts' : [ref('hr.dep_sales')],'holiday_type' : 'Validated' }} - (data, format) = netsvc.LocalService('report.holidays.summary').create(cr, uid, [], data_dict, {'active_ids': [ref('hr.employee2')]}) + data_dict = {'model': 'ir.ui.menu', 'form': {'date_from': time.strftime('%Y-%m-01'), 'depts' : [ref('hr.dep_sales')],'holiday_type' : 'Validated' }} + (data, format) = netsvc.LocalService('report.holidays.summary').create(cr, uid, [], data_dict, {'active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]}) if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_holidays-summary_report.'+format), 'wb+').write(data) \ No newline at end of file + file(os.path.join(tools.config['test_report_directory'], 'hr_holidays-dept_summary_report.'+format), 'wb+').write(data) + + data_dict = {'model': 'hr.employee', 'form': {'date_from': time.strftime('%Y-%m-01'), 'depts' : [ref('hr.dep_sales')],'holiday_type' : 'Validated','emp':[ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')] }} + (data, format) = netsvc.LocalService('report.holidays.summary').create(cr, uid, [], data_dict, {'active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]}) + if tools.config['test_report_directory']: + file(os.path.join(tools.config['test_report_directory'], 'hr_holidays-employee_summary_report.'+format), 'wb+').write(data) \ No newline at end of file