[FIX] hr_recruitment: count archived/refused for other applications

The fix introduced in odoo/odoo#119017 was no longer taking into account
the refused/archived applications, showing a negative number in some
cases.

task-3293460

closes odoo/odoo#120426

X-original-commit: 55e279f96c9d878103657f437222066ae74dcf0f
Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
Kevin Baptiste
2023-05-03 15:04:56 +02:00
parent 9221ad5e53
commit 7fc04795a8
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -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'),
@@ -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',