[FIX] hr_recruitment: correct count in mutli-company context

Steps to reproduce:
-------------------
- create a job position without specifying the company;
- being in the first company, create an application for this job position;
- being in the second company, create an other application;
- go to the job position kanban view;

Issue:
------
Despite the selected company, the count for this job application is still two.

Solution:
---------
Include the allowed companies in the query to count the number of applicants.

opw-3453348

closes odoo/odoo#133262

X-original-commit: 8bce129a9943448e51a0e672a1ac18a3c1221866
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
This commit is contained in:
Thomas Lefebvre (thle)
2023-08-28 09:34:04 +00:00
parent dbc660513c
commit 2fd34609b3
+2 -1
View File
@@ -183,8 +183,9 @@ class Job(models.Model):
ON s.job_id = a.job_id
AND a.stage_id = s.stage_id
AND a.active IS TRUE
WHERE a.company_id in %s
GROUP BY s.job_id
""", [tuple(self.ids), ]
""", [tuple(self.ids), tuple(self.env.companies.ids)]
)
new_applicant_count = dict(self.env.cr.fetchall())