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.

48 lines
2.3 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, context=None):
  12. icp = self.pool.get('ir.config_parameter')
  13. return {
  14. 'auth_admin_passkey_send_to_admin' : safe_eval(icp.get_param(cr, uid, 'auth_admin_passkey.send_to_admin', 'True')),
  15. }
  16. def set_auth_admin_passkey_send_to_admin(self, cr, uid, ids, context=None):
  17. config = self.browse(cr, uid, ids[0], context=context)
  18. icp = self.pool.get('ir.config_parameter')
  19. icp.set_param(cr, uid, 'auth_admin_passkey.send_to_admin', repr(config.auth_admin_passkey_send_to_admin))
  20. def get_default_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None):
  21. icp = self.pool.get('ir.config_parameter')
  22. return {
  23. 'auth_admin_passkey_send_to_user' : safe_eval(icp.get_param(cr, uid, 'auth_admin_passkey.send_to_user', 'True')),
  24. }
  25. def set_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None):
  26. config = self.browse(cr, uid, ids[0], context=context)
  27. icp = self.pool.get('ir.config_parameter')
  28. icp.set_param(cr, uid, 'auth_admin_passkey.send_to_user', repr(config.auth_admin_passkey_send_to_user))
  29. ### Columns Section
  30. _columns = {
  31. 'auth_admin_passkey_send_to_admin': fields.boolean(
  32. 'Send email to admin user.',
  33. help="When the administrator use his password to login in with "\
  34. "a different account, OpenERP will send an email to the admin user.",
  35. ),
  36. 'auth_admin_passkey_send_to_user': fields.boolean(
  37. string='Send email to user.',
  38. help="When the administrator use his password to login in with "\
  39. "a different account, OpenERP will send an email to the account user.",
  40. ),
  41. }