[IMP] use related field insted of function field to get manager_id of reated department
bzr revid: tpa@tinyerp.com-20130523132211-b9uf21w007i6adtb
This commit is contained in:
parent
f990ad3b36
commit
572c8ddfc6
|
@ -516,27 +516,13 @@ class hr_job(osv.osv):
|
|||
res[position.id] = {'priority1': priority1, 'priority2': priority2, 'priority3': priority3, 'total_application':len(rate_ids)}
|
||||
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 = employee_obj.search(cr, uid, [('id', '=', obj_job.department_id.manager_id.id)], context=context)
|
||||
if 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 = {
|
||||
'survey_id': fields.many2one('survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"),
|
||||
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True,
|
||||
help="Email alias for this job position. New emails will automatically "
|
||||
"create new applicants for this job position."),
|
||||
'priority_count': fields.function(_count_priority, string='Total Priority Employees', type="char"),
|
||||
'manager_id': fields.function(_get_department_mgr, string='Department Manager', type="char"),#manager image in kanban
|
||||
'manager_id': fields.related('department_id', 'manager_id', type='many2one', string='Department Manager', relation='hr.employee', readonly=True, store=True),
|
||||
'alias_prefix': fields.char("Alias Name Prefix For Jobs",help="Default Prefix for Alias name of jobs"),
|
||||
}
|
||||
_defaults = {
|
||||
|
|
|
@ -374,7 +374,7 @@
|
|||
<div class="oe_job oe_kanban_ellipsis">
|
||||
<field name="department_id"/>
|
||||
</div>
|
||||
<img t-att-src="kanban_image('hr.employee', 'image', record.manager_id.value.id, {'preview_image': 'image_small'})" t-att-title="record.manager_id.value.name" class="oe_kanban_avatar"/>
|
||||
<img t-att-src="kanban_image('hr.employee', 'image', record.manager_id.raw_value, {'preview_image': 'image_small'})" t-att-title="record.manager_id.value.name" class="oe_kanban_avatar"/>
|
||||
<div class="oe_name">
|
||||
<t t-esc="record.manager_id.value.name"/>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue