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: _compute_is_applicant_in_pool
| Inputs | Method | Outputs |
|---|---|---|
|
+ """ + Computes if an application is linked to a talent pool or not. + An application can either be directly or indirectly linked to a talent pool. + Direct link: + - 1. Application has talent_pool_ids set, meaning this application + is a talent pool application, or talent for short. + - 2. Application has pool_applicant_id set, meaning this application + is a copy or directly linked to a talent (scenario 1) + + Indirect link: + - 3. Application shares a phone number, email, or linkedin with a + direclty linked application. + + Note: While possible, linking an application to a pool through linking + it to an indirect link is currently excluded from the implementation + for technical reasons. + """ + direct = self.filtered(lambda a: a.talent_pool_ids or a.pool_applicant_id) + direct.is_applicant_in_pool = True + indirect = self - direct + if not indirect: + return + domain = self._get_similar_applicants_domain() & Domain(["|", ("talent_pool_ids", "!=", False), ("pool_applicant_id", "!=", False)]) + in_pool_applicants = self.env["hr.applicant"].with_context(active_test=False).search(domain) + in_pool_data = {"emails": set(), "phones": set(), "linkedins": set()} + for applicant in in_pool_applicants: + if applicant.email_normalized: + in_pool_data["emails"].add(applicant.email_normalized) + if applicant.partner_phone_sanitized: + in_pool_data["phones"].add(applicant.partner_phone_sanitized) + if applicant.linkedin_profile: + in_pool_data["linkedins"].add(applicant.linkedin_profile) + for applicant in indirect: + applicant.is_applicant_in_pool = ( + applicant.email_normalized in in_pool_data["emails"] + or applicant.partner_phone_sanitized in in_pool_data["phones"] + or applicant.linkedin_profile in in_pool_data["linkedins"] + ) |
|
