[FIX] website: get right access token for public visitor user
Current Behavior: When we get the access token for a website visitor, we check if the `self.env.user` is a public user. If it is, we return his id. Expected behavior: We should check the `request.env.user` instead since the visitor can only be created through the frontend. opw-2956186 Part-of: odoo/odoo#99181
This commit is contained in:
@@ -37,8 +37,8 @@ class WebsiteVisitor(models.Model):
|
||||
if not request:
|
||||
raise ValueError("Visitors can only be created through the frontend.")
|
||||
|
||||
if not self.env.user._is_public():
|
||||
return self.env.user.partner_id.id
|
||||
if not request.env.user._is_public():
|
||||
return request.env.user.partner_id.id
|
||||
|
||||
msg = repr((
|
||||
request.httprequest.remote_addr,
|
||||
|
||||
Reference in New Issue
Block a user