|
20 | 20 | # |
21 | 21 | ############################################################################## |
22 | 22 |
|
23 | | -from openerp.osv import fields |
24 | | -from openerp.osv.orm import TransientModel |
25 | | -from openerp.tools.safe_eval import safe_eval |
| 23 | +from openerp import api, fields, models |
26 | 24 |
|
27 | 25 |
|
28 | | -class base_config_settings(TransientModel): |
| 26 | +class base_config_settings(models.TransientModel): |
29 | 27 | _inherit = 'base.config.settings' |
30 | 28 |
|
31 | 29 | # Getter / Setter Section |
32 | | - def get_default_auth_admin_passkey_send_to_admin( |
33 | | - self, cr, uid, ids, context=None): |
34 | | - icp = self.pool['ir.config_parameter'] |
| 30 | + @api.model |
| 31 | + def get_default_auth_admin_passkey_send_to_admin(self, fields): |
35 | 32 | return { |
36 | | - 'auth_admin_passkey_send_to_admin': safe_eval(icp.get_param( |
37 | | - cr, uid, 'auth_admin_passkey.send_to_admin', 'True')), |
| 33 | + 'auth_admin_passkey_send_to_admin': |
| 34 | + self.env["ir.config_parameter"].get_param( |
| 35 | + "auth_admin_passkey.send_to_admin") |
38 | 36 | } |
39 | 37 |
|
40 | | - def set_auth_admin_passkey_send_to_admin(self, cr, uid, ids, context=None): |
41 | | - config = self.browse(cr, uid, ids[0], context=context) |
42 | | - icp = self.pool['ir.config_parameter'] |
43 | | - icp.set_param( |
44 | | - cr, uid, 'auth_admin_passkey.send_to_admin', |
45 | | - repr(config.auth_admin_passkey_send_to_admin)) |
| 38 | + @api.multi |
| 39 | + def set_auth_admin_passkey_send_to_admin(self): |
| 40 | + for config in self: |
| 41 | + self.env['ir.config_parameter'].set_param( |
| 42 | + "auth_admin_passkey.send_to_admin", |
| 43 | + config.auth_admin_passkey_send_to_admin or '') |
46 | 44 |
|
47 | | - def get_default_auth_admin_passkey_send_to_user( |
48 | | - self, cr, uid, ids, context=None): |
49 | | - icp = self.pool['ir.config_parameter'] |
| 45 | + @api.model |
| 46 | + def get_default_auth_admin_passkey_send_to_user(self, fields): |
50 | 47 | return { |
51 | | - 'auth_admin_passkey_send_to_user': safe_eval(icp.get_param( |
52 | | - cr, uid, 'auth_admin_passkey.send_to_user', 'True')), |
| 48 | + 'auth_admin_passkey_send_to_user': |
| 49 | + self.env["ir.config_parameter"].get_param( |
| 50 | + "auth_admin_passkey.send_to_user") |
53 | 51 | } |
54 | 52 |
|
55 | | - def set_auth_admin_passkey_send_to_user(self, cr, uid, ids, context=None): |
56 | | - config = self.browse(cr, uid, ids[0], context=context) |
57 | | - icp = self.pool['ir.config_parameter'] |
58 | | - icp.set_param( |
59 | | - cr, uid, 'auth_admin_passkey.send_to_user', |
60 | | - repr(config.auth_admin_passkey_send_to_user)) |
| 53 | + @api.multi |
| 54 | + def set_auth_admin_passkey_send_to_user(self): |
| 55 | + for config in self: |
| 56 | + self.env['ir.config_parameter'].set_param( |
| 57 | + "auth_admin_passkey.send_to_user", |
| 58 | + config.auth_admin_passkey_send_to_user or '') |
61 | 59 |
|
62 | | - # Columns Section |
63 | | - _columns = { |
64 | | - 'auth_admin_passkey_send_to_admin': fields.boolean( |
65 | | - 'Send email to admin user.', |
66 | | - help="""When the administrator use his password to login in """ |
67 | | - """with a different account, OpenERP will send an email """ |
68 | | - """to the admin user.""", |
69 | | - ), |
70 | | - 'auth_admin_passkey_send_to_user': fields.boolean( |
71 | | - string='Send email to user.', |
72 | | - help="""When the administrator use his password to login in """ |
73 | | - """with a different account, OpenERP will send an email """ |
74 | | - """to the account user.""", |
75 | | - ), |
76 | | - } |
| 60 | + auth_admin_passkey_send_to_admin = fields.Boolean( |
| 61 | + string='Send email to admin user.', |
| 62 | + help="""When the administrator use his password to login in """ |
| 63 | + """with a different account, OpenERP will send an email """ |
| 64 | + """to the admin user.""") |
| 65 | + |
| 66 | + auth_admin_passkey_send_to_user = fields.Boolean( |
| 67 | + string='Send email to user.', |
| 68 | + help="""When the administrator use his password to login in """ |
| 69 | + """with a different account, OpenERP will send an email """ |
| 70 | + """to the account user.""") |
0 commit comments