Files
app-odoo/app_odoo_customize/controllers/controllers.py
2024-03-05 19:57:31 +08:00

27 lines
1019 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import http
from odoo.addons.portal.controllers.web import Home
from odoo.http import request
class AppHome(Home):
@http.route()
def web_client(self, s_action=None, **kw):
# todo: 当前只对 web要调整为也对 website
res = super(AppHome, self).web_client(s_action, **kw)
if request.session.uid and request.env['res.users'].sudo().browse(request.session.uid).has_group('base.group_user') \
and kw.get('debug', False):
config_parameter = request.env['ir.config_parameter'].sudo()
app_debug_only_admin = config_parameter.get_param('app_debug_only_admin')
if request.session.uid and request.env.user.browse(request.session.uid)._is_admin():
pass
else:
if app_debug_only_admin:
return request.redirect('/web/session/logout?debug=0')
return res