Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Recruitment - Skills Management

Entity: hr.applicant

Compute Method: _compute_matching_score

Inputs Method Outputs
matching_job_id = self.env.context.get("matching_job_id")
matching_job = self.env["hr.job"].browse(matching_job_id)
for applicant in self:
            job = matching_job or applicant.job_id
            if not job or not (job.job_skill_ids or job.expected_degree):
                applicant.matching_score = False
                applicant.degree_score = False
                applicant.skills_score = False
                continue
            job_skills = job.job_skill_ids
            job_degree = job.expected_degree.sudo().score * 100
            job_skill_map = {js.skill_id: js.level_progress for js in job_skills}

            matching_applicant_skills = applicant.current_applicant_skill_ids.filtered(
                lambda a: a.skill_id in job_skill_map,
            )
            applicant_degree = applicant.type_id.score * 100 if job_degree > 1 else 0
            skills_total = sum(
                min(skill.level_progress, job_skill_map[skill.skill_id] * 2)
                for skill in matching_applicant_skills
            )
            job_total = sum(job_skills.mapped("level_progress")) + job_degree
            applicant.degree_score = round((100 * applicant_degree) / job_total) if job_total else 0
            applicant.skills_score = round((100 * skills_total) / job_total) if job_total else 0
            applicant.matching_score = applicant.degree_score + applicant.skills_score

Back to entity