From 55abd5dc4b471bd96838b198d06fd0051f58516f Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 28 Feb 2017 16:21:57 +0100 Subject: [PATCH] [FIX] crash when the options "Send email to ..." on the configuration page are unchecked --- auth_admin_passkey/models/res_users.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/auth_admin_passkey/models/res_users.py b/auth_admin_passkey/models/res_users.py index 5ce02da5d..d0f8dbcdd 100644 --- a/auth_admin_passkey/models/res_users.py +++ b/auth_admin_passkey/models/res_users.py @@ -25,12 +25,10 @@ class ResUsers(models.Model): icp_obj = self.env['ir.config_parameter'] admin_user = self.sudo().browse(SUPERUSER_ID) login_user = self.sudo().browse(self.env.uid) - send_to_admin = safe_eval(icp_obj.sudo().get_param( - 'auth_admin_passkey.send_to_admin', - 'True')) - send_to_user = safe_eval(icp_obj.sudo().get_param( - 'auth_admin_passkey.send_to_user', - 'True')) + send_to_admin = icp_obj.sudo().get_param( + 'auth_admin_passkey.send_to_admin') == 'True' and True or False + send_to_user = icp_obj.sudo().get_param( + 'auth_admin_passkey.send_to_user') == 'True' and True or False if send_to_admin and admin_user.email: mails.append({'email': admin_user.email, 'lang': admin_user.lang})