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.

36 lines
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. # (c) 2015 ACSONE SA/NV, Dhinesh D
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp import models, api, tools, SUPERUSER_ID
  5. DELAY_KEY = 'inactive_session_time_out_delay'
  6. IGNORED_PATH_KEY = 'inactive_session_time_out_ignored_url'
  7. class IrConfigParameter(models.Model):
  8. _inherit = 'ir.config_parameter'
  9. @tools.ormcache(skiparg=0)
  10. def get_session_parameters(self, db):
  11. param_model = self.pool['ir.config_parameter']
  12. cr = self.pool.cursor()
  13. delay = False
  14. urls = []
  15. try:
  16. delay = int(param_model.get_param(
  17. cr, SUPERUSER_ID, DELAY_KEY, 7200))
  18. urls = param_model.get_param(
  19. cr, SUPERUSER_ID, IGNORED_PATH_KEY, '').split(',')
  20. finally:
  21. cr.close()
  22. return delay, urls
  23. @api.multi
  24. def write(self, vals, context=None):
  25. res = super(IrConfigParameter, self).write(vals)
  26. if self.key in [DELAY_KEY, IGNORED_PATH_KEY]:
  27. self.get_session_parameters.clear_cache(self)
  28. return res