[IMP] hr_attendance: small code cleanup in tests
bzr revid: rco@openerp.com-20111221125246-jxt83mz4g5r2q0zp
This commit is contained in:
parent
c028b3050d
commit
7e685270d2
|
@ -47,8 +47,9 @@ actions(Sign in/Sign out) performed by them.
|
|||
'wizard/hr_attendance_sign_in_out_view.xml',
|
||||
],
|
||||
'demo_xml': ['hr_attendance_demo.xml'],
|
||||
'test': ['test/attendance_process.yml',
|
||||
'test/hr_attendance_report.yml',
|
||||
'test': [
|
||||
'test/attendance_process.yml',
|
||||
'test/hr_attendance_report.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
-
|
||||
In order to test attendance process in OpenERP, At the time of login,
|
||||
-
|
||||
I will use "Sign In/Sign Out" wizard for attendances.
|
||||
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
|
||||
|
@ -11,10 +9,10 @@
|
|||
-
|
||||
!python {model: hr.sign.in.out}: |
|
||||
obj_attendance = self.pool.get('hr.employee')
|
||||
emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Antoine Philippe")])
|
||||
if emp_id:
|
||||
employee = obj_attendance.read(cr, uid, emp_id)[0]
|
||||
self.write(cr, uid, [ref('employee_sign_in')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]})
|
||||
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".
|
||||
|
@ -26,10 +24,10 @@
|
|||
-
|
||||
!python {model: hr.sign.in.out}: |
|
||||
obj_attendance = self.pool.get('hr.employee')
|
||||
emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Antoine Philippe")])
|
||||
if emp_id:
|
||||
employee = obj_attendance.read(cr, uid, emp_id)[0]
|
||||
self.write(cr, uid, [ref('employee_sign_in')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]})
|
||||
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.
|
||||
|
@ -42,12 +40,12 @@
|
|||
-
|
||||
!python {model: hr.sign.in.out.ask}: |
|
||||
obj_attendance = self.pool.get('hr.employee')
|
||||
emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Antoine Philippe")])
|
||||
if emp_id:
|
||||
employee = obj_attendance.read(cr, uid, emp_id)[0]
|
||||
self.write(cr, uid, [ref('hr_sign_in_out_ask_Antoine_Philippe')], {'emp_id': emp_id[0]})
|
||||
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.employee3, severity: error, string: Employee should be in present state}:
|
||||
- state == 'present'
|
||||
- state == 'present'
|
||||
|
|
|
@ -2,19 +2,16 @@
|
|||
Print the HR Attendance Report By Month through the wizard
|
||||
-
|
||||
!python {model: hr.employee}: |
|
||||
import time
|
||||
ctx={}
|
||||
ctx.update({'model': 'hr.employee','active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]})
|
||||
data_dict = {}
|
||||
from tools import test_reports
|
||||
ctx = {'model': 'hr.employee','active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]}
|
||||
data_dict = {}
|
||||
test_reports.try_report_action(cr, uid, 'action_hr_attendance_month',wiz_data=data_dict, context=ctx, our_module='hr_attendance')
|
||||
-
|
||||
Print HR Attendance Error Report through the wizard
|
||||
-
|
||||
!python {model: hr.employee}: |
|
||||
import time
|
||||
ctx={}
|
||||
ctx.update({'model': 'hr.employee','active_ids': [ref('hr.employee1')]})
|
||||
data_dict = {'init_date': time.strftime('%Y-01-01')}
|
||||
from tools import test_reports
|
||||
ctx = {'model': 'hr.employee','active_ids': [ref('hr.employee1')]}
|
||||
data_dict = {'init_date': time.strftime('%Y-01-01')}
|
||||
test_reports.try_report_action(cr, uid, 'action_hr_attendance_error',wiz_data=data_dict, context=ctx, our_module='hr_attendance')
|
||||
|
|
Loading…
Reference in New Issue