[IMP] Recruitment: count applicant priority ratio in job position
bzr revid: ggh@tinyerp.com-20130402065052-ghvng16dau69dpca
This commit is contained in:
@@ -492,15 +492,36 @@ class hr_job(osv.osv):
|
||||
_inherit = "hr.job"
|
||||
_name = "hr.job"
|
||||
_inherits = {'mail.alias': 'alias_id'}
|
||||
|
||||
def _count_priority(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for position in self.browse(cr, uid,ids, context=context):
|
||||
res[position.id] = {}
|
||||
priority1 = 0
|
||||
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):
|
||||
if applicant.job_id.id == position.id:
|
||||
if applicant.priority == '3':
|
||||
priority1 += 1
|
||||
elif applicant.priority == '2':
|
||||
priority2 += 1
|
||||
elif applicant.priority == '1':
|
||||
priority3 += 1
|
||||
else:
|
||||
pass
|
||||
res[position.id] = {'priority1': priority1, 'priority2': priority2, 'priority3': priority3}
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Job Name', size=128, required=True, select=True),
|
||||
'no_of_recruitment': fields.float('Expected in Recruitment', help='Number of new employees you expect to recruit.'),
|
||||
'department_id': fields.many2one('hr.department', 'Department'),
|
||||
'color': fields.integer('Color Index'),
|
||||
'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"),
|
||||
}
|
||||
_defaults = {
|
||||
'alias_domain': False, # always hide alias during creation
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
parent="base.menu_crm_case_job_req_main"
|
||||
id="menu_crm_case_categ0_act_job" action="crm_case_categ0_act_job" sequence="1"/>
|
||||
|
||||
<menuitem parent="base.menu_crm_case_job_req_main" id="hr.menu_hr_job_position" action="hr.action_hr_job" sequence="-1"/>
|
||||
<menuitem parent="base.menu_crm_case_job_req_main" id="hr.menu_hr_job_position" action="action_hr_job" sequence="-1"/>
|
||||
|
||||
|
||||
</data>
|
||||
|
||||
@@ -331,6 +331,7 @@
|
||||
<field name="department_id"/>
|
||||
<field name="no_of_recruitment"/>
|
||||
<field name="color"/>
|
||||
<field name="priority_count"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_semantic_html_override oe_kanban_survey">
|
||||
@@ -344,11 +345,26 @@
|
||||
</div>
|
||||
<div class="oe_kanban_content">
|
||||
<h3 class="oe_kanban_ellipsis"><field name="name"/></h3>
|
||||
<field name="department_id"/><br/>
|
||||
<a><span t-if="record.no_of_recruitment.raw_value gt 0"><field name="no_of_recruitment"/>Employees</span></a>
|
||||
|
||||
<div>
|
||||
<field name="department_id"/>
|
||||
<a><t t-esc="widget.values.priority_count.value.priority1"/></a>
|
||||
<span>
|
||||
<img t-attf-src="/web/static/src/img/icons/star-on.png" width="16" height="16" />
|
||||
<img t-attf-src="/web/static/src/img/icons/star-on.png" width="16" height="16" />
|
||||
<img t-attf-src="/web/static/src/img/icons/star-on.png" width="16" height="16" />
|
||||
</span><br />
|
||||
<a><t t-esc="widget.values.priority_count.value.priority2"/></a>
|
||||
<span>
|
||||
<img t-attf-src="/web/static/src/img/icons/star-on.png" width="16" height="16" />
|
||||
<img t-attf-src="/web/static/src/img/icons/star-on.png" width="16" height="16" />
|
||||
</span><br />
|
||||
<a><t t-esc="widget.values.priority_count.value.priority3"/></a>
|
||||
<span>
|
||||
<img t-attf-src="/web/static/src/img/icons/star-on.png" width="16" height="16" />
|
||||
</span>
|
||||
</div>
|
||||
<br/>
|
||||
<a><span t-if="record.no_of_recruitment.raw_value gt 0"><field name="no_of_recruitment"/>Employees</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
@@ -359,7 +375,7 @@
|
||||
|
||||
|
||||
<!-- hr related job position menu action -->
|
||||
<record model="ir.actions.act_window" id="hr.action_hr_job">
|
||||
<record model="ir.actions.act_window" id="action_hr_job">
|
||||
<field name="name">Job Positions</field>
|
||||
<field name="res_model">hr.job</field>
|
||||
<field name="view_type">form</field>
|
||||
|
||||
Reference in New Issue
Block a user