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.

58 lines
2.0 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright (C) 2013-2014 GRAP (http://www.grap.coop)
  3. # @author Sylvain LE GAL (https://twitter.com/legalsylvain)
  4. # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
  5. from odoo import api, fields, models
  6. from odoo.tools.safe_eval import safe_eval
  7. class BaseConfigSettings(models.TransientModel):
  8. _inherit = 'base.config.settings'
  9. @api.model
  10. def get_default_auth_admin_passkey_send_to_admin(self, fields):
  11. icp = self.env['ir.config_parameter']
  12. return {
  13. 'auth_admin_passkey_send_to_admin': safe_eval(icp.get_param(
  14. 'auth_admin_passkey.send_to_admin', 'True')),
  15. }
  16. @api.model
  17. def get_default_auth_admin_passkey_send_to_user(self, fields):
  18. icp = self.env['ir.config_parameter']
  19. return {
  20. 'auth_admin_passkey_send_to_user': safe_eval(icp.get_param(
  21. 'auth_admin_passkey.send_to_user', 'True')),
  22. }
  23. auth_admin_passkey_send_to_admin = fields.Boolean(
  24. 'Send email to admin user.',
  25. help=('When the administrator use his password to login in '
  26. 'with a different account, Odoo will send an email '
  27. 'to the admin user.'),
  28. )
  29. auth_admin_passkey_send_to_user = fields.Boolean(
  30. string='Send email to user.',
  31. help=('When the administrator use his password to login in '
  32. 'with a different account, Odoo will send an email '
  33. 'to the account user.'),
  34. )
  35. @api.multi
  36. def set_auth_admin_passkey_send_to_admin(self):
  37. self.ensure_one()
  38. icp = self.env['ir.config_parameter']
  39. icp.set_param(
  40. 'auth_admin_passkey.send_to_admin',
  41. repr(self.auth_admin_passkey_send_to_admin))
  42. @api.multi
  43. def set_auth_admin_passkey_send_to_user(self):
  44. self.ensure_one()
  45. icp = self.env['ir.config_parameter']
  46. icp.set_param(
  47. 'auth_admin_passkey.send_to_user',
  48. repr(self.auth_admin_passkey_send_to_user))