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_document_ids
| Inputs | Method | Outputs |
|---|---|---|
|
- applicants = self.mapped('application_ids').filtered(lambda self: not self.emp_id) + applicants = self.mapped('application_ids').filtered(lambda self: not self.employee_id) app_to_job = dict((applicant.id, applicant.job_id.id) for applicant in applicants) attachments = self.env['ir.attachment'].search([ '|', '&', ('res_model', '=', 'hr.job'), ('res_id', 'in', self.ids), '&', ('res_model', '=', 'hr.applicant'), ('res_id', 'in', applicants.ids)]) result = dict.fromkeys(self.ids, self.env['ir.attachment']) for attachment in attachments: if attachment.res_model == 'hr.applicant': result[app_to_job[attachment.res_id]] |= attachment else: result[attachment.res_id] |= attachment for job in self: job.document_ids = result.get(job.id, False) job.documents_count = len(job.document_ids) |
|
