From a3a4f5f0c8b6ce6a7b371854d45cdf28cda1a742 Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Tue, 26 Sep 2023 12:05:57 +0530 Subject: [PATCH] Sep 26 : [FIX] Bug Fixed 'user_login_alert' --- user_login_alert/__manifest__.py | 2 +- user_login_alert/controllers/main.py | 9 +++------ user_login_alert/doc/RELEASE_NOTES.md | 5 +++++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/user_login_alert/__manifest__.py b/user_login_alert/__manifest__.py index 231be83eb..d6461883f 100644 --- a/user_login_alert/__manifest__.py +++ b/user_login_alert/__manifest__.py @@ -22,7 +22,7 @@ 'name': 'User Login Alert', 'summary': """Secure your Odoo account by alerts at right time. If any successful login to your account happens, an alert mail will be send to you with the browser and IP details.""", - 'version': '16.0.1.0.0', + 'version': '16.0.1.0.1', 'description': """Secure your Odoo account by alerts at right time. If any successful login to your account happens, an alert mail will be send to you with the browser and IP details, Odoo 16, Odoo16""", 'author': 'Cybrosys Techno Solutions', diff --git a/user_login_alert/controllers/main.py b/user_login_alert/controllers/main.py index 7fa23f2cd..6c774ee2a 100644 --- a/user_login_alert/controllers/main.py +++ b/user_login_alert/controllers/main.py @@ -32,7 +32,6 @@ import odoo.modules.registry from odoo.tools.translate import _ from odoo import http - class Home(home.Home): @http.route('/web/login', type='http', auth="public") @@ -56,11 +55,9 @@ class Home(home.Home): request.params['login'], request.params['password']) if uid is not False: - user_rec = request.env['res.users'].sudo().search( - [('id', '=', uid)]) + user_rec = request.env['res.users'].sudo().browse(uid) if user_rec.partner_id.email and user_rec.has_group( 'user_login_alert.receive_login_notification'): - send_mail = 0 agent = request.httprequest.environ.get('HTTP_USER_AGENT') agent_details = httpagentparser.detect(agent) user_os = agent_details['os']['name'] @@ -105,8 +102,8 @@ class Home(home.Home): 'email_from': request.env.user.company_id.email, 'email_to': email_to } - template_id = template_obj.create(template_data) - template_obj.send(template_id) + template_id = template_obj.sudo().create(template_data) + template_id.send() request.params['login_success'] = True if not redirect: redirect = '/web' diff --git a/user_login_alert/doc/RELEASE_NOTES.md b/user_login_alert/doc/RELEASE_NOTES.md index 9a53f26b2..015dcefe2 100644 --- a/user_login_alert/doc/RELEASE_NOTES.md +++ b/user_login_alert/doc/RELEASE_NOTES.md @@ -4,3 +4,8 @@ #### Version 16.0.1.0.0 #### ADD Migration Of User Login Alert + +#### 26.09.2023 +#### Version 16.0.1.0.1 +#### BUGFIX +- Bug Fix: Fixed an issue with the email sending function. Access issue resolved