[FIX] website_crm: allow salesman to see page views of a lead

Side effect of https://github.com/odoo/odoo/commit/69cc2911b52fd17b37fb71544574f63cf09dd17e.

On a lead, there is a smart button allowing to see his page views on the website.
In case we have many views, we are grouping them by page. Currently, the check on
the pages is made through field page_ids which is restricted to Website Editor
access group. We should allow a regular salesman to see page views without error,
and this can be achived by using field website_track_ids.page_id instead.

closes odoo/odoo#75761

X-original-commit: 76e1d609ad0e6d9a3dd2703185f4b87759823c70
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
This commit is contained in:
alt-odoo
2021-08-31 02:33:48 +00:00
parent ad5f8e2eff
commit 9339b0d685
+1 -1
View File
@@ -33,7 +33,7 @@ class Lead(models.Model):
action = self.env["ir.actions.actions"]._for_xml_id("website.website_visitor_page_action")
action['domain'] = [('visitor_id', 'in', visitors.ids)]
# avoid grouping if only few records
if len(visitors.website_track_ids.ids) > 15 and len(visitors.page_ids.ids) > 1:
if len(visitors.website_track_ids) > 15 and len(visitors.website_track_ids.page_id) > 1:
action['context'] = {'search_default_group_by_page': '1'}
return action