This commit moves the whole customer portal to the portal module. It now completely uses portal and http_routing features and is not dependent on website anymore. An override of web controller is added in portal in order to redirect portal users to /my instead of /web. That way once having the customer portal installed all share users are correctly redirected to their account. All modules defining customer portal templates and controllers are updated accordingly.
21 lines
796 B
Python
21 lines
796 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import http
|
|
from odoo.addons.web.controllers.main import Home
|
|
from odoo.http import request
|
|
|
|
|
|
class Home(Home):
|
|
|
|
@http.route()
|
|
def index(self, *args, **kw):
|
|
if request.session.uid and not request.env['res.users'].sudo().browse(request.session.uid).has_group('base.group_user'):
|
|
return http.local_redirect('/my', query=request.params, keep_hash=True)
|
|
return super(Home, self).index(*args, **kw)
|
|
|
|
def _login_redirect(self, uid, redirect=None):
|
|
if not redirect and not request.env['res.users'].sudo().browse(uid).has_group('base.group_user'):
|
|
return '/my'
|
|
return super(Home, self)._login_redirect(uid, redirect=redirect)
|