You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
822 B

  1. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  2. from odoo import models
  3. from odoo.http import request
  4. class Http(models.AbstractModel):
  5. _inherit = "ir.http"
  6. def session_info(self): # pragma: no cover
  7. result = super().session_info()
  8. user = request.env.user
  9. allowed_profiles = [(profile.id, profile.name) for profile in user.profile_ids]
  10. if len(allowed_profiles) > 1:
  11. current_profile = (user.profile_id.id, user.profile_id.name)
  12. result["user_profiles"] = {
  13. "current_profile": current_profile,
  14. "allowed_profiles": allowed_profiles,
  15. }
  16. else:
  17. result["user_profiles"] = False
  18. result["profile_id"] = user.profile_id.id if request.session.uid else None
  19. return result