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

Module: Recruitment

Entity: hr.job

Compute Method: _compute_applicant_hired

Inputs Method Outputs
  • id
hired_stages = self.env['hr.recruitment.stage'].search([('hired_stage', '=', True)])
hired_data = self.env['hr.applicant']._read_group([
            ('job_id', 'in', self.ids),
            ('stage_id', 'in', hired_stages.ids),
        ], ['job_id'], ['__count'])
job_hires = {job.id: count for job, count in hired_data}
for job in self:
            job.applicant_hired = job_hires.get(job.id, 0)

Back to entity