fix: Trigger notifications after updating last_login, last_ip fields
Notifications for User doctype based on Value Change in last_ip, last_login, last_active aren't triggered because of updates performed through frappe.db.sql. This behavior is fixed by explicitly triggering notifications.
This commit is contained in:
parent
7b7289431e
commit
71fc4cbd3a
1 changed files with 3 additions and 1 deletions
|
|
@ -231,6 +231,7 @@ class Session:
|
|||
self.insert_session_record()
|
||||
|
||||
# update user
|
||||
user = frappe.get_doc("User", self.data['user'])
|
||||
frappe.db.sql("""UPDATE `tabUser`
|
||||
SET
|
||||
last_login = %(now)s,
|
||||
|
|
@ -241,7 +242,8 @@ class Session:
|
|||
'ip': frappe.local.request_ip,
|
||||
'name': self.data['user']
|
||||
})
|
||||
|
||||
user.run_notifications("before_change")
|
||||
user.run_notifications("on_update")
|
||||
frappe.db.commit()
|
||||
|
||||
def insert_session_record(self):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue