[IMP]project_timesheet : Improve the test cases

bzr revid: dbr@tinyerp.com-20110826131839-tadw5ajn0guq470q
This commit is contained in:
DBR (OpenERP)
2011-08-26 18:48:39 +05:30
parent 5906bf6b5a
commit 71b2a9d0c9
@@ -64,7 +64,12 @@
!record {model: project.project, id: project_project_timesheetmanagement0}:
company_id: base.main_company
name: Timesheet Management
-
Change the partner to the realted project
-
!python {model: project.project}: |
self.onchange_partner_id(cr, uid, [ref('project_project_timesheetmanagement0')], part=False, context=None)
-
Create a task 'Get all timesheet records'
@@ -86,6 +91,7 @@
"en_US", "active_ids": [ref("project_project_timesheetmanagement0")], "tz":
False, "active_model": "project.project", "department_id": False, "project_id":
False, "active_id": ref("project_project_timesheetmanagement0"), })
self.write(cr, uid, [ref('project_task_getalltimesheetrecords0')], {'name': 'Get all timesheet records','project_id': ref('project_project_timesheetmanagement0'),'user_id': ref('res_users_hrmanager0')},context)
-
Make a work task entry 'Get work calendar of all employees' of 10 hours done by HR manager
@@ -96,9 +102,40 @@
hours: 10.0
name: Get work calendar of all employees
user_id: res_users_hrmanager0
-
Creating a project.task.work record
-
!record {model: project.task.work, id: project_task_work_test0}:
company_id: base.main_company
date: !eval time.strftime('%Y-06-%d')
hours: 10.0
name: test
task_id: project_task_getalltimesheetrecords0
user_id: res_users_hrmanager0
-
Add the work details
-
!python {model: project.task.work}: |
import time
vals = {
'company_id': ref('base.main_company'),
'date': time.strftime('%Y-06-%d'),
'hours': 10.0,
'name': 'test',
'task_id': ref('project_task_getalltimesheetrecords0'),
'user_id': ref('res_users_hrmanager0'),
}
self.get_user_related_details(cr, uid, ref('res_users_hrmanager0'))
self.write(cr, uid, [ref('project_task_work_test0')], vals,context)
self.unlink(cr, uid, [ref('project_task_work_test0')])
-
Check for timesheet_ids in HR manager's timesheet
-
!assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_sheetforhrmanager0, string: After hr manager's work task, length of timesheet line of current timesheet must be greater then 1}:
- len(timesheet_ids) > 0
-
Unlink the task
-
!python {model: project.task}: |
self.unlink(cr, uid, [ref("project_task_getalltimesheetrecords0")])