odoo/addons/hr_attendance/test/attendance_process.yml

52 lines
2.2 KiB
YAML

-
In order to test attendance process in OpenERP, at the time of login, I use "Sign In/Sign Out" wizard for attendances.
-
!record {model: hr.sign.in.out, id: employee_sign_in}:
name: Antoine Philippe
state: absent
-
I click on this wizard to login.
-
!python {model: hr.sign.in.out}: |
obj_attendance = self.pool.get('hr.employee')
emp_ids = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Antoine Philippe")])
if emp_ids:
employee = obj_attendance.read(cr, uid, emp_ids)[0]
self.write(cr, uid, [ref('employee_sign_in')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_ids[0]})
self.si_check(cr, uid, [ref("employee_sign_in")])
-
I check that Employee is "Present".
-
!assert {model: hr.employee, id: hr.employee_al, severity: error, string: Employee should be in present state}:
- state == 'present'
-
I click on "Sign In" button of this wizard, this will Open a new form which ask for Last Sign Out date.
-
!python {model: hr.sign.in.out}: |
obj_attendance = self.pool.get('hr.employee')
emp_ids = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Antoine Philippe")])
if emp_ids:
employee = obj_attendance.read(cr, uid, emp_ids)[0]
self.write(cr, uid, [ref('employee_sign_in')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_ids[0]})
self.si_check(cr, uid, [ref("employee_sign_in")])
-
I select Last Sign Out date.
-
!record {model: hr.sign.in.out.ask, id: hr_sign_in_out_ask_Antoine_Philippe}:
last_time: !eval time.strftime('%Y-%m-%d %H:%M:%S')
name: Antoine Philippe
-
Now I click on "Sign In" button of this wizard.
-
!python {model: hr.sign.in.out.ask}: |
obj_attendance = self.pool.get('hr.employee')
emp_ids = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Antoine Philippe")])
if emp_ids:
employee = obj_attendance.read(cr, uid, emp_ids)[0]
self.write(cr, uid, [ref('hr_sign_in_out_ask_Antoine_Philippe')], {'emp_id': emp_ids[0]})
-
Finally i check the employee is present.
-
!assert {model: hr.employee, id: hr.employee_al, severity: error, string: Employee should be in present state}:
- state == 'present'