summaryrefslogtreecommitdiff
path: root/addons/website/models/website_visitor.py
diff options
context:
space:
mode:
authorPierre Paridans <app@odoo.com>2019-10-02 09:32:58 +0000
committerPierre Paridans <app@odoo.com>2019-10-02 09:32:58 +0000
commit245ef4b0fddc7e5da3ebe841438c2d2902933f14 (patch)
treef1db3136117a0430f55879d920f4027478d055d6 /addons/website/models/website_visitor.py
parent2e8307b5f14b5d1113f8dc4e74625f4704625168 (diff)
[FIX] website: check uid on request.env
Without this commit, connection with mobile app crash since there are no uid set on the env. _is_public_user expecting singleton. closes odoo/odoo#37756 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website/models/website_visitor.py')
-rw-r--r--addons/website/models/website_visitor.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/website/models/website_visitor.py b/addons/website/models/website_visitor.py
index 75670433d3d..6f035f5be6c 100644
--- a/addons/website/models/website_visitor.py
+++ b/addons/website/models/website_visitor.py
@@ -164,7 +164,10 @@ class WebsiteVisitor(models.Model):
It is possible that the partner has changed or has disconnected.
In that case the cookie is still referencing the old visitor and need to be replaced
with the one of the visitor returned !!!. """
- if not request:
+
+ # This function can be called in json with mobile app.
+ # In case of mobile app, no uid is set on the jsonRequest env.
+ if not request or not request.env.uid:
return None
Visitor = self.env['website.visitor'].sudo()
visitor = Visitor