[IMP] some fixes in HR: #employees -> integer not float, forecasted employees is fixed and 'in recruitment' is computed so that it is still correct after doing a new recruitment

bzr revid: fp@openerp.com-20131111203209-cpoqpwsvepkl1elx
This commit is contained in:
Fabien Pinckaers 2013-11-11 21:32:09 +01:00
parent eb3cc55347
commit 43af25742e
3 changed files with 20 additions and 28 deletions

View File

@ -81,7 +81,7 @@ class hr_job(osv.osv):
nb_employees = len(job.employee_ids or [])
res[job.id] = {
'no_of_employee': nb_employees,
'expected_employees': nb_employees + job.no_of_recruitment,
'no_of_recruitment': max(0, (job.expected_employees or nb_employees) - nb_employees),
}
return res
@ -97,24 +97,21 @@ class hr_job(osv.osv):
_inherit = ['mail.thread']
_columns = {
'name': fields.char('Job Name', size=128, required=True, select=True),
# TO CLEAN: when doing a cleaning, we should change like this:
# no_of_recruitment: a function field
# expected_employees: float
# This would allow a clean update when creating new employees.
'expected_employees': fields.function(_no_of_employee, string='Total Forecasted Employees',
help='Expected number of employees for this job position after new recruitment.',
'no_of_recruitment': fields.function(_no_of_employee, string='Expected in Recruitment',
help='Number of new employees you expect to recruit.',
store = {
'hr.job': (lambda self,cr,uid,ids,c=None: ids, ['no_of_recruitment'], 10),
'hr.employee': (_get_job_position, ['job_id'], 10),
},
'hr.job': (lambda self,cr,uid,ids,c=None: ids, ['expected_employees'], 10),
'hr.employee': (_get_job_position, ['job_id'], 11),
}, type='integer',
multi='no_of_employee'),
'no_of_employee': fields.function(_no_of_employee, string="Current Number of Employees",
help='Number of employees currently occupying this job position.',
store = {
'hr.employee': (_get_job_position, ['job_id'], 10),
},
}, type='integer',
multi='no_of_employee'),
'no_of_recruitment': fields.float('Expected in Recruitment', help='Number of new employees you expect to recruit.'),
'expected_employees': fields.integer('Total Forecasted Employees',
help='Expected number of employees for this job position after new recruitment.'),
'employee_ids': fields.one2many('hr.employee', 'job_id', 'Employees', groups='base.group_user'),
'description': fields.text('Job Description'),
'requirements': fields.text('Requirements'),
@ -133,20 +130,15 @@ class hr_job(osv.osv):
('name_company_uniq', 'unique(name, company_id, department_id)', 'The name of the job position must be unique per department in company!'),
]
def on_change_expected_employee(self, cr, uid, ids, no_of_recruitment, no_of_employee, context=None):
if context is None:
context = {}
return {'value': {'expected_employees': no_of_recruitment + no_of_employee}}
def job_recruitement(self, cr, uid, ids, *args):
for job in self.browse(cr, uid, ids):
no_of_recruitment = job.no_of_recruitment == 0 and 1 or job.no_of_recruitment
self.write(cr, uid, [job.id], {'state': 'recruit', 'no_of_recruitment': no_of_recruitment})
expected = max(job.no_of_employee + 1, job.expected_employees)
self.write(cr, uid, [job.id], {'state': 'recruit', 'expected_employees': expected})
return True
def job_open(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {'state': 'open', 'no_of_recruitment': 0})
for job in self.browse(cr, uid, ids):
self.write(cr, uid, ids, {'state': 'open', 'expected_employees': job.no_of_employee})
return True

View File

@ -31,7 +31,7 @@
<record id="job_ceo" model="hr.job">
<field name="name">Chief Executive Officer</field>
<field name="department_id" ref="dep_management"/>
<field name="description"><![CDATA[<div class="oe_structure">Demonstration of different openerp services for each client and convincing the client about functionality of the application.
<field name="description">Demonstration of different openerp services for each client and convincing the client about functionality of the application.
The candidate should have excellent communication skills.
Relationship building and influencing skills
Expertise in New Client Acquisition (NCAs) and Relationship Management.
@ -39,15 +39,15 @@ Gathering market and customer information.
Coordinating with the sales and support team for adopting different strategies
Reviewing progress and identifying opportunities and new areas for development.
Building strong relationships with clients / customers for business growth profitability.
Keep regular interaction with key clients for better extraction and expansion. </div>]]></field>
<field name="requirements"><![CDATA[<div class="oe_structure">MBA in Marketing is must.
Keep regular interaction with key clients for better extraction and expansion.</field>
<field name="requirements">MBA in Marketing is must.
Good Communication skills.
Only Fresher's can apply.
Candidate should be ready to work in young and dynamic environment..
Candidate should be able to work in “start- up” fast paced environment,hands on attitude.
Honest,approachable and fun team player.
Result driven.
Excellent analytical skills, ability to think logically and "out of the box" </div>]]></field>
Excellent analytical skills, ability to think logically and "out of the box"</field>
</record>
<record id="job_cto" model="hr.job">

View File

@ -343,9 +343,9 @@
</div>
<group>
<group name="job_data">
<field name="no_of_employee" groups="base.group_user"/>
<field name="no_of_recruitment" on_change="on_change_expected_employee(no_of_recruitment,no_of_employee)"/>
<field name="expected_employees" groups="base.group_user"/>
<field name="no_of_employee"/>
<field name="no_of_recruitment"/>
<field name="expected_employees"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="department_id"/>
</group>