[Add]: hr_holidays: create yaml for hr_holidays module.
authoratp (Open ERP) <atp@tinyerp.co.in>
Wed, 26 May 2010 10:07:02 +0000 (15:37 +0530)
committeratp (Open ERP) <atp@tinyerp.co.in>
Wed, 26 May 2010 10:07:02 +0000 (15:37 +0530)
bzr revid: atp@tinyerp.co.in-20100526100702-08nskxmv56fy4nrw

addons/hr_holidays/__openerp__.py
addons/hr_holidays/test/test_hr_holiday.yml [new file with mode: 0644]

index 3f0cd36..f00fa4d 100644 (file)
@@ -62,6 +62,7 @@
         #'process/hr_holidays_process.xml'
     ],
     'demo_xml': ['hr_holidays_demo.xml',],
+    'test': ['test/test_hr_holiday.yml'],
     'installable': True,
     'active': False,
     'certificate': '0086579209325',
diff --git a/addons/hr_holidays/test/test_hr_holiday.yml b/addons/hr_holidays/test/test_hr_holiday.yml
new file mode 100644 (file)
index 0000000..960d12f
--- /dev/null
@@ -0,0 +1,112 @@
+- |
+  In order to test the hr_holiday in OpenERP, I will  Manage leaves for employee,
+  Leave requests.
+- |
+  For that First I create new user "user1" to make leave request.
+- 
+  !record {model: res.users, id: res_users_user0}:
+    company_id: base.main_company
+    context_lang: en_US
+    groups_id:
+      - base.group_user
+      - hr.group_hr_manager
+      - hr.group_hr_user
+    login: user1
+    name: user1
+    password: user1
+- |
+  Now, I create a new employee “Mark Johnshon” as Manager to validate employee leave.
+-
+  !record {model: hr.employee, id: hr_employee_employee0}:
+    address_home_id: base.res_partner_address_1
+    company_id: base.main_company
+    gender: male
+    name: Mark Johnson
+    user_id: base.user_root
+- |
+  create another employee "Brijesh Patel" as "user1" who make leave request.
+- 
+  !record {model: hr.employee, id: hr_employee_brijeshpatel0}:
+    address_home_id: base.res_partner_address_8
+    name: Brijesh Patel
+    parent_id: 'hr_employee_employee0'
+    user_id: 'res_users_user0'
+- |
+  Given that I have  Leave type for employee.
+- 
+  !record {model: hr.holidays.status, id: hr_holidays_status_fullleave0}:
+    color_name: red
+    name: Full Leave.
+    limit: 1
+
+- |
+  After that I allocate leave request for employee "Brijesh Patel".
+- 
+  !record {model: hr.holidays, id: hr_holidays_allocateleaveforuser0}:
+    allocation_type: employee
+    employee_id: 'hr_employee_brijeshpatel0'
+    holiday_status_id: hr_holidays_status_fullleave0
+    name: Allocate leave for user1
+    number_of_days_temp: 12.0
+    date_from: '05/20/2010 13:59:00'
+    date_to: '05/22/2010 13:59:00'
+    type: add
+- | 
+  I click on "Confirm" button to confirm allocate leave for employee.
+- 
+  !workflow {model: hr.holidays, action: confirm, ref: hr_holidays_allocateleaveforuser0}
+       
+- |
+  I click on "Validate" button to validate leave for employee.
+-
+  !workflow {model: hr.holidays, action: validate,  ref: hr_holidays_allocateleaveforuser0}  
+
+- |
+  Now employee "Brijesh Patel" want to leave. so, I connect as user1 which is username of this employee and want to make leave request.     
+- 
+  !record {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}:
+    allocation_type: employee
+    date_from: '2010-05-20 11:48:00'
+    date_to: '2010-05-21 11:48:00'
+    employee_id: 'hr_employee_brijeshpatel0'
+    holiday_status_id: 'hr_holidays_status_fullleave0'
+    name: I want to leave for go to hospital
+    notes: I want to leave for go to hospital. so please accept my leave.
+    number_of_days_temp: 2.0
+    type: remove
+    user_id: 'res_users_user0'
+- |
+  I check that Leave Request is on "Draft" state.
+-
+  !assert {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}:
+    - state == 'draft'  
+       
+- |
+  Now I confirm my leave Request by click on "Confirm" button.
+- 
+  !workflow {model: hr.holidays, action: confirm, ref: hr_holidays_iwanttoleaveforgotohospital0}
+  
+- |
+  Now I connect as Admin user and Open Leave request of "Brijesh Patel".
+  and "validate" it by click on "validate" button.
+- 
+  !workflow {model: hr.holidays, action: validate,  ref: hr_holidays_iwanttoleaveforgotohospital0}
+  
+- |
+  I check that "Leave Manager" field is automaticly filled by the user who validate the leave'.
+-
+  !python {model: hr.holidays}: |
+     ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
+     obj = self.browse(cr, uid, ref('hr_holidays_iwanttoleaveforgotohospital0'))
+     assert ids2[0] == obj.manager_id.id
+  
+- | 
+  I check that Leave request state is "Validated".
+- 
+  !assert {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}:
+    - state == "validate" 
+  
+- |
+  I can also see Summary of Employee's holiday by using 'Print Summary of Employee's Holidays'.
+  This will allow you to choose if you want to print either the Confirmed & Validated holidays or only the Validated ones. 
+               
\ No newline at end of file