From 579f67166a25bd3b072edf92c24df99b3568eaf7 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 4 Jun 2018 15:47:01 +0200 Subject: [PATCH] [FIX] websiste: determinist homepage for portal users In the portal module, the `index` method from the `web` module controllers is overriden to redirect `/` to the portal `/my` for the portal users, instead of the regular backend `/web`. However, when `website` is installed, this behavior should not happen, as you would like the signed in portal users to be able to see the website homepage, and not to be redirected to `my` when they try to access `/` root path of the website. Because the override in the website module was done on the `index` method coming from the `web` module instead of the `portal`, according in which way the Python module were loaded, it sometimes redirected to `/my`, sometimes it correctly displayed the homepage. This is because the modules are not loaded in a determinist order. To summarize, on runbot, if you logged as portal/portal, one time on two you were redirected to `/my`, and the other time you saw the homepage correctly. As `website` depends on `portal`, we have the possibility to override the `index` method of `portal` instead of the one of `web`, to force the determinist order, and therefore the determinist behavior of the homepage for portal users. --- addons/website/controllers/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 62d862afe35..ead68c28274 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -18,8 +18,9 @@ from odoo import http, models, fields, _ from odoo.http import request from odoo.tools import pycompat, OrderedSet from odoo.addons.http_routing.models.ir_http import slug, _guess_mimetype -from odoo.addons.web.controllers.main import WebClient, Binary, Home +from odoo.addons.web.controllers.main import WebClient, Binary from odoo.addons.portal.controllers.portal import pager as portal_pager +from odoo.addons.portal.controllers.web import Home logger = logging.getLogger(__name__)