|
| 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 | + |
| 6 | +from openerp import api, fields, models |
| 7 | + |
| 8 | + |
| 9 | +class BaseConfigSettings(models.TransientModel): |
| 10 | + _inherit = 'base.config.settings' |
| 11 | + |
| 12 | + # Getter / Setter Section |
| 13 | + @api.model |
| 14 | + def get_default_auth_admin_passkey_send_to_admin(self, fields): |
| 15 | + return { |
| 16 | + 'auth_admin_passkey_send_to_admin': |
| 17 | + self.env["ir.config_parameter"].get_param( |
| 18 | + "auth_admin_passkey.send_to_admin") |
| 19 | + } |
| 20 | + |
| 21 | + @api.multi |
| 22 | + def set_auth_admin_passkey_send_to_admin(self): |
| 23 | + for config in self: |
| 24 | + self.env['ir.config_parameter'].set_param( |
| 25 | + "auth_admin_passkey.send_to_admin", |
| 26 | + config.auth_admin_passkey_send_to_admin or '') |
| 27 | + |
| 28 | + @api.model |
| 29 | + def get_default_auth_admin_passkey_send_to_user(self, fields): |
| 30 | + return { |
| 31 | + 'auth_admin_passkey_send_to_user': |
| 32 | + self.env["ir.config_parameter"].get_param( |
| 33 | + "auth_admin_passkey.send_to_user") |
| 34 | + } |
| 35 | + |
| 36 | + @api.multi |
| 37 | + def set_auth_admin_passkey_send_to_user(self): |
| 38 | + for config in self: |
| 39 | + self.env['ir.config_parameter'].set_param( |
| 40 | + "auth_admin_passkey.send_to_user", |
| 41 | + config.auth_admin_passkey_send_to_user or '') |
| 42 | + |
| 43 | + auth_admin_passkey_send_to_admin = fields.Boolean( |
| 44 | + string='Send email to admin 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 admin user.""") |
| 48 | + |
| 49 | + auth_admin_passkey_send_to_user = fields.Boolean( |
| 50 | + string='Send email to user.', |
| 51 | + help="""When the administrator use his password to login in """ |
| 52 | + """with a different account, OpenERP will send an email """ |
| 53 | + """to the account user.""") |
0 commit comments