diff --git a/addons/hr_recruitment/models/hr_applicant.py b/addons/hr_recruitment/models/hr_applicant.py index 6890d2e5df9..c869ac1f912 100644 --- a/addons/hr_recruitment/models/hr_applicant.py +++ b/addons/hr_recruitment/models/hr_applicant.py @@ -137,7 +137,7 @@ class Applicant(models.Model): for applicant in self: domain = applicant._get_similar_applicants_domain() if domain: - applicant.application_count = self.env["hr.applicant"].search_count(domain) - 1 + applicant.application_count = self.env["hr.applicant"].with_context(active_test=False).search_count(domain) - 1 else: applicant.application_count = 0 @@ -416,7 +416,7 @@ class Applicant(models.Model): other_applicants = self.env['hr.applicant'] domain = self._get_similar_applicants_domain() if domain: - other_applicants = self.env['hr.applicant'].search(domain) + other_applicants = self.env['hr.applicant'].with_context(active_test=False).search(domain) return { 'type': 'ir.actions.act_window', 'name': _('Job Applications'), diff --git a/addons/hr_recruitment/tests/test_recruitment.py b/addons/hr_recruitment/tests/test_recruitment.py index 2cbf8e03bd6..8a059dc6ae3 100644 --- a/addons/hr_recruitment/tests/test_recruitment.py +++ b/addons/hr_recruitment/tests/test_recruitment.py @@ -33,6 +33,7 @@ class TestRecruitment(TransactionCase): """ A, B, C, D, E, F, _ = self.env['hr.applicant'].create([ { + 'active': False, # Refused/archived application should still count 'name': 'Application A', 'email_from': 'abc@odoo.com', 'partner_phone': '123',