From 34e5bdc6f777a945f6b43a3cda9f6f2850807b2e Mon Sep 17 00:00:00 2001 From: Huy Date: Tue, 29 Mar 2022 08:06:23 +0000 Subject: [PATCH] [FIX] website_crm: skip archived visitors in stat button Currently stat button on crm.lead form view still shows page views count of archived visitor records. This is not coherent with the action performed when clicking which filters out archived records. We now correctly count only active visitors page count. closes odoo/odoo#87574 X-original-commit: 325aaebca2d7b6b3a0e285f957e2be5736e7c69e Signed-off-by: Thibault Delavallee (tde) --- addons/website_crm/models/crm_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_crm/models/crm_lead.py b/addons/website_crm/models/crm_lead.py index 83c7c8e7a92..dd9da4aa92e 100644 --- a/addons/website_crm/models/crm_lead.py +++ b/addons/website_crm/models/crm_lead.py @@ -20,7 +20,7 @@ class Lead(models.Model): JOIN crm_lead_website_visitor_rel lv ON l.id = lv.crm_lead_id JOIN website_visitor v ON v.id = lv.website_visitor_id JOIN website_track p ON p.visitor_id = v.id - WHERE l.id in %s + WHERE l.id in %s AND v.active = TRUE GROUP BY l.id""" self.env.cr.execute(sql, (tuple(self.ids),)) page_data = self.env.cr.dictfetchall()