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.

56 lines
2.4 KiB

  1. # -*- encoding: utf-8 -*-
  2. ################################################################################
  3. # See __openerp__.py file for Copyright and Licence Informations.
  4. ################################################################################
  5. from openerp.osv import fields
  6. from openerp.osv.orm import TransientModel
  7. from openerp.tools.safe_eval import safe_eval
  8. class base_config_settings(TransientModel):
  9. _inherit = 'base.config.settings'
  10. ### Getter / Setter Section
  11. def get_default_auth_admin_passkey_send_to_admin(self, cr, uid, ids,
  12. context=None):
  13. icp = self.pool('ir.config_parameter')
  14. return {
  15. 'auth_admin_passkey_send_to_admin' : safe_eval(icp.get_param(cr,
  16. uid, 'auth_admin_passkey.send_to_admin', 'True')),
  17. }
  18. def set_auth_admin_passkey_send_to_admin(self, cr, uid, ids, context=None):
  19. config = self.browse(cr, uid, ids[0], context=context)
  20. icp = self.pool('ir.config_parameter')
  21. icp.set_param(cr, uid, 'auth_admin_passkey.send_to_admin',
  22. repr(config.auth_admin_passkey_send_to_admin))
  23. def get_default_auth_admin_passkey_send_to_user(self, cr, uid, ids,
  24. context=None):
  25. icp = self.pool('ir.config_parameter')
  26. return {
  27. 'auth_admin_passkey_send_to_user' : safe_eval(icp.get_param(cr,
  28. uid, 'auth_admin_passkey.send_to_user', 'True')),
  29. }
  30. def set_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None):
  31. config = self.browse(cr, uid, ids[0], context=context)
  32. icp = self.pool('ir.config_parameter')
  33. icp.set_param(cr, uid, 'auth_admin_passkey.send_to_user',
  34. repr(config.auth_admin_passkey_send_to_user))
  35. ### Columns Section
  36. _columns = {
  37. 'auth_admin_passkey_send_to_admin': fields.boolean(
  38. 'Send email to admin user.',
  39. help="When the administrator use his password to login in "\
  40. "with a different account, OpenERP will send an email "\
  41. "to the admin user.",
  42. ),
  43. 'auth_admin_passkey_send_to_user': fields.boolean(
  44. string='Send email to user.',
  45. help="When the administrator use his password to login in "\
  46. "with a different account, OpenERP will send an email "\
  47. "to the account user.",
  48. ),
  49. }