[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:
Nasreddin Boulif (bon)
2022-09-02 19:13:53 +02:00
parent c89853c219
commit 156e2f1fc3
+2 -2
View File
@@ -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,