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

Compute Method: _get_attachment_number

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

Back to entity