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.

67 lines
2.8 KiB

  1. ###################################################################################
  2. #
  3. # Copyright (c) 2017-today MuK IT GmbH.
  4. #
  5. # This file is part of MuK Backend Theme
  6. # (see https://mukit.at).
  7. #
  8. # MuK Proprietary License v1.0
  9. #
  10. # This software and associated files (the "Software") may only be used
  11. # (executed, modified, executed after modifications) if you have
  12. # purchased a valid license from MuK IT GmbH.
  13. #
  14. # The above permissions are granted for a single database per purchased
  15. # license. Furthermore, with a valid license it is permitted to use the
  16. # software on other databases as long as the usage is limited to a testing
  17. # or development environment.
  18. #
  19. # You may develop modules based on the Software or that use the Software
  20. # as a library (typically by depending on it, importing it and using its
  21. # resources), but without copying any source code or material from the
  22. # Software. You may distribute those modules under the license of your
  23. # choice, provided that this license is compatible with the terms of the
  24. # MuK Proprietary License (For example: LGPL, MIT, or proprietary licenses
  25. # similar to this one).
  26. #
  27. # It is forbidden to publish, distribute, sublicense, or sell copies of
  28. # the Software or modified copies of the Software.
  29. #
  30. # The above copyright notice and this permission notice must be included
  31. # in all copies or substantial portions of the Software.
  32. #
  33. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  34. # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  36. # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  37. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  38. # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  39. # DEALINGS IN THE SOFTWARE.
  40. #
  41. ###################################################################################
  42. from odoo import models
  43. from odoo.http import request
  44. class IrHttp(models.AbstractModel):
  45. _inherit = "ir.http"
  46. #----------------------------------------------------------
  47. # Functions
  48. #----------------------------------------------------------
  49. def session_info(self):
  50. result = super(IrHttp, self).session_info()
  51. if request.env.user._is_internal():
  52. for company in request.env.user.company_ids:
  53. result['user_companies']['allowed_companies'][company.id].update({
  54. 'has_background_image': bool(company.background_image),
  55. })
  56. result['pager_autoload_interval'] = int(
  57. self.env['ir.config_parameter'].sudo().get_param(
  58. 'muk_web_theme.autoload', default=30000
  59. )
  60. )
  61. return result