[IMP] hr_recruitment: Improve code

bzr revid: ggh@tinyerp.com-20130403104229-kgfdhg94lygfzvfz
This commit is contained in:
ggh-openerp 2013-04-03 16:12:29 +05:30
parent b8d2569a5a
commit d1e9bfab5e
3 changed files with 12 additions and 5 deletions

View File

@ -118,6 +118,7 @@ class hr_job(osv.osv):
'company_id': fields.many2one('res.company', 'Company'),
'state': fields.selection([('open', 'No Recruitment'), ('recruit', 'Recruitement in Progress')], 'Status', readonly=True, required=True,
help="By default 'In position', set it to 'In Recruitment' if recruitment process is going on for this job position."),
'color': fields.integer('Color Index'),
}
_defaults = {
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr.job', context=c),

View File

@ -494,6 +494,8 @@ class hr_job(osv.osv):
_inherits = {'mail.alias': 'alias_id'}
def _count_priority(self, cr, uid, ids, name, args, context=None):
"""Applicant, priority count like number of star 3,2,1(star rating)
"""
res = {}
for position in self.browse(cr, uid,ids, context=context):
res[position.id] = {}
@ -501,8 +503,8 @@ class hr_job(osv.osv):
priority2 = 0
priority3 = 0
applicant_obj = self.pool.get('hr.applicant')
a_ids = applicant_obj.search(cr, uid, [('job_id', '=', position.id)], context=context)
for applicant in self.pool.get('hr.applicant').browse(cr, uid, a_ids, context=context):
rate_ids = applicant_obj.search(cr, uid, [('job_id', '=', position.id)], context=context)
for applicant in self.pool.get('hr.applicant').browse(cr, uid, rate_ids, context=context):
if applicant.job_id.id == position.id:
if applicant.priority == '3':
priority1 += 1
@ -516,14 +518,18 @@ class hr_job(osv.osv):
return res
def _get_department_mgr(self, cr, uid, ids, name, args, context=None):
"""get manager image for specific job position.
"""
res = {}
employee_obj = self.pool.get('hr.employee')
for obj_job in self.browse(cr, uid,ids, context=context):
res[obj_job.id] = {}
if obj_job.department_id:
emp_ids = self.pool.get('hr.employee').search(cr, uid, [('id', '=', obj_job.department_id.manager_id.id)], context=context)
emp_ids = employee_obj.search(cr, uid, [('id', '=', obj_job.department_id.manager_id.id)], context=context)
if emp_ids:
res[obj_job.id] = emp_ids
for employee in employee_obj.browse(cr, uid, emp_ids, context=context):
res[obj_job.id] = {'id':employee.id, 'name': employee.name}
return res
_columns = {

View File

@ -347,7 +347,7 @@
<div class="oe_kanban_content">
<h3 class="oe_kanban_ellipsis"><field name="name"/></h3>
<field name="department_id"/>
<div class="oe_kanban_right"><img t-att-src="kanban_image('hr.employee', 'image_small', widget.values.user_id.value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/></div><br />
<div class="oe_kanban_right"><img t-att-src="kanban_image('hr.employee', 'image_small', widget.values.user_id.value.id)" t-att-title="record.user_id.value.name" width="24" height="24" class="oe_kanban_avatar"/></div><br />
<a><span t-if="record.no_of_recruitment.raw_value gt 0"><field name="no_of_recruitment"/>Employees</span></a>
<div>