[MERGE] polish2-improve_testcase_yml_hr-jap (hr)

bzr revid: rco@openerp.com-20111209141835-1mjirmml0gm3durb
This commit is contained in:
Raphael Collet
2011-12-09 15:18:35 +01:00
4 changed files with 52 additions and 141 deletions
+4 -1
View File
@@ -54,7 +54,10 @@ You can manage:
'hr_demo.xml',
'hr_department_demo.xml',
],
'test': ['test/test_hr.yml'],
'test': [
'test/open2recruit2close_job.yml',
'test/hr_demo.yml',
],
'installable': True,
'active': False,
'certificate': '0086710558965',
+10
View File
@@ -0,0 +1,10 @@
-
!record {model: hr.job, id: job_jr_appli, view: False}:
no_of_employee: 0.0
no_of_recruitment: 5.0
-
!record {model: hr.employee, id: employee1, view: False}:
address_id: base.main_address
company_id: base.main_company
department_id: dep_technical
user_id: base.user_demo
+38
View File
@@ -0,0 +1,38 @@
-
In order to test the process of Human Resource Management, I open Job Postion for "Jr. Application Engineer".
-
!python {model: hr.job}: |
self.job_open(cr, uid, [ref('job_jr_appli')])
-
I check state of Job Position after opening it.
-
!assert {model: hr.job, id: job_jr_appli, string: Job position is in 'open' state and no_of_recruitment = 0}:
- state == 'open'
- no_of_recruitment == 0
-
Now, Recruitement is started so I start recruitement of Job Postion of "Jr. Application Engineer" Profile.
-
!python {model: hr.job}: |
self.job_recruitement(cr, uid, [ref('job_jr_appli')])
-
I check 'state' and number of 'Expected in Recruitment' after initiating the recruitment
-
!assert {model: hr.job, id: job_jr_appli, string: Job position is in 'recruit' state and no_of_recruitment = 1.0}:
- state == 'recruit'
- no_of_recruitment == 1.0
-
I assign the job position to a newly hired employee
-
!python {model: hr.employee}: |
self.write(cr, uid, [ref('employee1')], {'job_id':ref('job_jr_appli')})
-
Now I don't want to recruit new employee for this position. so I mark it as Old.
-
!python {model: hr.job}: |
self.job_old(cr, uid, [ref('job_jr_appli')])
-
I check 'state' and number of 'Expected in Recruitment' after closing the Job position.
-
!assert {model: hr.job, id: job_jr_appli, string: Job position is in 'old' state and no_of_recruitment = 0}:
- state == 'old'
- no_of_recruitment == 0
-140
View File
@@ -1,140 +0,0 @@
-
In order to test hr module in OpenERP, I will create new Employee, Department and Job Position.
-
I create "RD Department" in Department form.
-
!record {model: hr.department, id: hr_department_rd0}:
manager_id: base.user_root
name: 'R & D'
-
Now, I create a new employee Mark Johnson, and select department as RD Department.
-
!record {model: hr.employee, id: hr_employee_mark}:
address_home_id: base.res_partner_address_1
company_id: base.main_company
gender: male
marital: 'single'
name: Mark Johnson
-
I change the company of the employee.
-
!python {model: hr.employee}: |
res = self.onchange_company(cr, uid, [ref('hr_employee_mark')], ref('base.main_company'), None)
values = dict([('company_id', ref('base.main_company'))] + res['value'].items())
self.write(cr, uid, [ref('hr_employee_mark')], values, None)
-
I assign department for employee Mark Johnson.
-
!python {model: hr.employee}: |
res = self.onchange_department_id(cr, uid, [ref('hr_employee_mark')], ref('hr_department_rd0'), None)
assert res['value']['parent_id']
values = dict([('department_id', ref('hr_department_rd0'))] + res['value'].items())
self.write(cr, uid, [ref('hr_employee_mark')], values, None)
-
Now I create a user for employee Mark Johnson.
-
!record {model: res.users, id: hr_users_markjohnson0}:
context_lang: en_US
groups_id:
- base.group_user
login: markjohnson
name: Mark Johnson
password: markjohnson
-
I assign user to employee Mark Johnson.
-
!python {model: hr.employee}: |
res = self.onchange_user(cr, uid, [ref('hr_employee_mark')], ref('hr_users_markjohnson0'), None)
values = dict([('user_id', ref('hr_users_markjohnson0'))] + res['value'].items())
self.write(cr, uid, [ref('hr_employee_mark')], values, None)
-
In order to check the wizard Employee Hierarchy , I will create new employee Phil Graves and select Mark Johnson as
Manager.
-
!record {model: hr.employee, id: hr_employee_phil}:
address_home_id: base.res_partner_address_3000
company_id: base.main_company
gender: male
name: Phil Graves
user_id: base.user_demo
parent_id: 'hr_employee_mark'
-
I fill the Working address for Employee.
-
!python {model: hr.employee}: |
res = self.onchange_address_id(cr, uid, ref('hr_employee_phil'), ref('base.res_partner_address_3000'), None)
assert res['value']
values = dict([('address_id', ref('base.res_partner_address_3000'))] + res['value'].items())
self.write(cr, uid, [ref('hr_employee_phil')], values, None)
-
I will open up form view of Mark Johnson and test the wizard Employee Hierarchy so it display the employee
hierarchy starting from Mark Johnson.
-
I will create new Job Position. I will check successful creation of new Job Position by adding the information.
-
!record {model: hr.job, id: hr_job_jea0}:
department_id: 'hr_department_rd0'
description: 'Position of Junior Application Engineer'
expected_employees: 5
name: 'JAE'
-
I check that Employee form is in "Open" state.
-
!assert {model: hr.job, id: hr_job_jea0}:
- state == 'open'
-
I create Employee for job position.
-
!record {model: hr.job, id: hr_job_jea0}:
employee_ids:
- address_home_id: base.res_partner_address_1
name: Manuel Lehba
department_id: 'hr_department_rd0'
gender: male
parent_id: 'hr_employee_mark'
-
I check that "Number of Employees" field have some value.
-
!assert {model: hr.job, id: hr_job_jea0}:
- no_of_employee != False
-
As more requirements on the said job position are come, I increase the number of expected employees.
-
!python {model: hr.job}: |
res = self.on_change_expected_employee(cr, uid, [ref('hr_job_jea0')], 6, 3, None)
assert res['value']['expected_employees']
values = dict([('expected_employees', ref('hr_job_jea0'))] + res['value'].items())
self.write(cr, uid, [ref('hr_job_jea0')], values, None)
-
I open the job position for recruitment.
-
!python {model: hr.job}: |
self.job_recruitement(cr, uid, [ref('hr_job_jea0')])
-
I assign the job position to employee and mark the position.
-
!python {model: hr.job}: |
self.job_open(cr, uid, [ref('hr_job_jea0')])
-
Now the process is over so I don't want to use this position. I mark it as Old.
-
!python {model: hr.job}: |
self.job_old(cr, uid, [ref('hr_job_jea0')])
-
I create a parent category for the new recruited employees who are Freshers.
-
!record {model: hr.employee.category, id: hr_employee_category_fresher0}:
name: Fresher
-
I create another category for Junior Level freshers.
-
!record {model: hr.employee.category, id: hr_employee_category_juniorlevel0}:
name: Junior Level
parent_id: hr_employee_category_fresher0
-
I open the tree view of Categories and see the categories in a hierarchical manner.
-
!python {model: hr.employee.category}: |
res = self.name_get(cr, uid, [ref('hr_employee_category_juniorlevel0')], None)
assert res