中国本土应用
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

45 lines
1.4KB

  1. # -*- coding: utf-8 -*-
  2. import json
  3. import logging
  4. from pickle import TRUE
  5. from odoo import http
  6. from odoo.exceptions import AccessError
  7. from odoo.http import request
  8. from odoo.addons.web.controllers.home import Home as WebHome
  9. from odoo.addons.web.controllers.utils import is_user_internal,ensure_db
  10. class Home(WebHome):
  11. @http.route()
  12. def web_client(self, s_action=None, **kw):
  13. ensure_db()
  14. if not request.session.uid:
  15. return request.redirect('/web/login', 303)
  16. storage_mode = int(request.env['res.users'].browse(request.session.uid).company_id.lock_screen_state_storage_mode)
  17. if "lock_screen_session_info" in request.session:
  18. lock_screen_session_info = request.session["lock_screen_session_info"]
  19. lock_screen_state = lock_screen_session_info["state"]
  20. else:
  21. lock_screen_state = False
  22. if storage_mode == 1:
  23. if lock_screen_state:
  24. return request.redirect('/web/lock', 303)
  25. # return request.redirect_query("/web/lock", "")
  26. elif storage_mode == 2:
  27. lock_screen = request.env["res.users"].browse(request.session.uid).lock_screen
  28. if (
  29. request.session.uid
  30. and is_user_internal(request.session.uid)
  31. and lock_screen
  32. ):
  33. return request.redirect_query("/web/lock", "")
  34. return super().web_client(s_action, **kw)
上海开阖软件有限公司 沪ICP备12045867号-1