From 2fd34609b34df031cbbe24f90310d87e1bdb3508 Mon Sep 17 00:00:00 2001 From: "Thomas Lefebvre (thle)" Date: Thu, 24 Aug 2023 15:16:49 +0200 Subject: [PATCH] [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) Signed-off-by: Thomas Lefebvre (thle) --- addons/hr_recruitment/models/hr_job.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/hr_recruitment/models/hr_job.py b/addons/hr_recruitment/models/hr_job.py index 8b6e1b2ddec..4bef7a16889 100644 --- a/addons/hr_recruitment/models/hr_job.py +++ b/addons/hr_recruitment/models/hr_job.py @@ -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())