flectra/addons/portal/controllers/web.py

21 lines
814 B
Python
Raw Permalink Normal View History

# -*- coding: utf-8 -*-
2018-01-16 11:34:37 +01:00
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
2018-01-16 11:34:37 +01:00
from flectra import http
from flectra.addons.web.controllers.main import Home
from flectra.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)