[FIX] website_crm: fix access error for users without CRM rights
1. Backport of [1]. 2. Steps to reproduce: - Install website_crm - Connect as Admin and remove the sales rights for Demo - Check the website on a private window (to create an anonymous visit) - Connect as Demo on the normal window - Go to Website > Reporting > Visitors => It triggers an access error due to lead_ids being restricted to sales_team.group_sale_salesman. (Note: the error sometimes isn't triggered at that point. In that case, click on the visitor: the same error will trigger.) Considering the computed field doesn't do anything critical as it just retrieves the email and phone number, the restriction is overridden on the field. [1]: https://github.com/odoo/odoo/commit/7de453477d7c23e607a15e0d60613080857e3371 opw-3475301 closes odoo/odoo#136362 X-original-commit: 70faf9bb07c9d801b3b06b325fc33de66c8406f3 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -21,7 +21,7 @@ class WebsiteVisitor(models.Model):
|
||||
super(WebsiteVisitor, self)._compute_email_phone()
|
||||
|
||||
left_visitors = self.filtered(lambda visitor: not visitor.email or not visitor.mobile)
|
||||
leads = left_visitors.mapped('lead_ids').sorted('create_date', reverse=True)
|
||||
leads = left_visitors.sudo().mapped('lead_ids').sorted('create_date', reverse=True)
|
||||
visitor_to_lead_ids = dict((visitor.id, visitor.lead_ids.ids) for visitor in left_visitors)
|
||||
|
||||
for visitor in left_visitors:
|
||||
|
||||
Reference in New Issue
Block a user