diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py
index c7b2dbc62aedaa165463b562f8f6c541510d4021..aad6cf6fabcb4e095f30212f99a6b5d43f4a78c5 100644
--- a/addons/website/models/ir_http.py
+++ b/addons/website/models/ir_http.py
@@ -193,7 +193,12 @@ class Http(models.AbstractModel):
         context['website_id'] = request.website.id
         # This is mainly to avoid access errors in website controllers where there is no
         # context (eg: /shop), and it's not going to propagate to the global context of the tab
-        context['allowed_company_ids'] = [request.website.company_id.id]
+        # If the company of the website is not in the allowed companies of the user, set the main
+        # company of the user.
+        if request.website.company_id in request.env.user.company_ids:
+            context['allowed_company_ids'] = request.website.company_id.ids
+        else:
+            context['allowed_company_ids'] = request.env.user.company_id.ids
 
         # modify bound context
         request.context = dict(request.context, **context)