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.candidate

Compute Method: _compute_attachment_count

Inputs Method Outputs
  • id
read_group_res = self.env['ir.attachment']._read_group(
            [('res_model', '=', 'hr.candidate'), ('res_id', 'in', self.ids)],
            ['res_id'], ['__count'])
attach_data = dict(read_group_res)
for candidate in self:
            candidate.attachment_count = attach_data.get(candidate.id, 0)

Back to entity