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_employee_count

Inputs Method Outputs
  • id
res = {
            job.id: count
            for job, count in self.env['hr.employee'].sudo()._read_group(
                domain=[
                    ('job_id', 'in', self.ids),
                    ('company_id', 'in', self.env.companies.ids),
                ],
                groupby=['job_id'],
                aggregates=['__count'],
            )
        }
for job in self:
            job.employee_count = res.get(job.id, 0)

Back to entity