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.

76 lines
3.1 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. # -*- encoding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # Admin Passkey module for OpenERP
  5. # Copyright (C) 2013-2014 GRAP (http://www.grap.coop)
  6. # @author Sylvain LE GAL (https://twitter.com/legalsylvain)
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU Affero General Public License as
  10. # published by the Free Software Foundation, either version 3 of the
  11. # License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU Affero General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU Affero General Public License
  19. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. #
  21. ##############################################################################
  22. from openerp.osv import fields
  23. from openerp.osv.orm import TransientModel
  24. from openerp.tools.safe_eval import safe_eval
  25. class base_config_settings(TransientModel):
  26. _inherit = 'base.config.settings'
  27. # Getter / Setter Section
  28. def get_default_auth_admin_passkey_send_to_admin(
  29. self, cr, uid, ids, context=None):
  30. icp = self.pool['ir.config_parameter']
  31. return {
  32. 'auth_admin_passkey_send_to_admin': safe_eval(icp.get_param(
  33. cr, uid, 'auth_admin_passkey.send_to_admin', 'True')),
  34. }
  35. def set_auth_admin_passkey_send_to_admin(self, cr, uid, ids, context=None):
  36. config = self.browse(cr, uid, ids[0], context=context)
  37. icp = self.pool['ir.config_parameter']
  38. icp.set_param(
  39. cr, uid, 'auth_admin_passkey.send_to_admin',
  40. repr(config.auth_admin_passkey_send_to_admin))
  41. def get_default_auth_admin_passkey_send_to_user(
  42. self, cr, uid, ids, context=None):
  43. icp = self.pool['ir.config_parameter']
  44. return {
  45. 'auth_admin_passkey_send_to_user': safe_eval(icp.get_param(
  46. cr, uid, 'auth_admin_passkey.send_to_user', 'True')),
  47. }
  48. def set_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None):
  49. config = self.browse(cr, uid, ids[0], context=context)
  50. icp = self.pool['ir.config_parameter']
  51. icp.set_param(
  52. cr, uid, 'auth_admin_passkey.send_to_user',
  53. repr(config.auth_admin_passkey_send_to_user))
  54. # Columns Section
  55. _columns = {
  56. 'auth_admin_passkey_send_to_admin': fields.boolean(
  57. 'Send email to admin user.',
  58. help="""When the administrator use his password to login in """
  59. """with a different account, OpenERP will send an email """
  60. """to the admin user.""",
  61. ),
  62. 'auth_admin_passkey_send_to_user': fields.boolean(
  63. string='Send email to user.',
  64. help="""When the administrator use his password to login in """
  65. """with a different account, OpenERP will send an email """
  66. """to the account user.""",
  67. ),
  68. }