[FIX] hr_attendance: fix mismatch between user and employee in test

bzr revid: rco@openerp.com-20111222153911-olkpskmw23mbmyed
This commit is contained in:
Raphael Collet 2011-12-22 16:39:11 +01:00
parent da81033958
commit bb3331680f
1 changed files with 20 additions and 21 deletions

View File

@ -1,19 +1,15 @@
-
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: Antony Lesuisse
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', '=', "Antony Lesuisse")])
hr_employee = self.pool.get('hr.employee')
uid = ref('base.user_al')
emp_ids = hr_employee.search(cr, uid, [('user_id', '=', uid)])
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")])
employee = hr_employee.browse(cr, uid, emp_ids)[0]
id = self.create(cr, uid, {'emp_id': employee.id, 'name': employee.name, 'state': employee.state})
self.si_check(cr, uid, [id])
-
I check that Employee is "Present".
-
@ -23,27 +19,30 @@
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', '=', "Antony Lesuisse")])
hr_employee = self.pool.get('hr.employee')
uid = ref('base.user_al')
emp_ids = hr_employee.search(cr, uid, [('user_id', '=', uid)])
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")])
employee = hr_employee.browse(cr, uid, emp_ids)[0]
id = self.create(cr, uid, {'emp_id': employee.id, 'name': employee.name, 'state': employee.state})
self.si_check(cr, uid, [id])
-
I select Last Sign Out date.
-
!record {model: hr.sign.in.out.ask, id: hr_sign_in_out_ask_Antoine_Philippe}:
!record {model: hr.sign.in.out.ask, id: hr_sign_in_out_ask_Antony}:
last_time: !eval time.strftime('%Y-%m-%d %H:%M:%S')
name: Antoine Philippe
name: Antony
-
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', '=', "Antony Lesuisse")])
import time
hr_employee = self.pool.get('hr.employee')
uid = ref('base.user_al')
emp_ids = hr_employee.search(cr, uid, [('user_id', '=', uid)])
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]})
employee = hr_employee.browse(cr, uid, emp_ids)[0]
id = self.create(cr, uid, {'emp_id': employee.id, 'name': employee.name, 'last_time': time.strftime('%Y-%m-%d %H:%M:%S')})
-
Finally i check the employee is present.
-