From a8d11f23d81ef406ebc20fa6d95de3206f137d24 Mon Sep 17 00:00:00 2001 From: Parth Kharwar Date: Fri, 26 Feb 2021 16:40:09 +0530 Subject: [PATCH] fix: adds check before enabling notification settings --- .../doctype/notification_settings/notification_settings.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frappe/desk/doctype/notification_settings/notification_settings.py b/frappe/desk/doctype/notification_settings/notification_settings.py index 4b32252ac8..3ee68c440c 100644 --- a/frappe/desk/doctype/notification_settings/notification_settings.py +++ b/frappe/desk/doctype/notification_settings/notification_settings.py @@ -44,7 +44,8 @@ def create_notification_settings(user): _doc.insert(ignore_permissions=True) def enable_disable_notifications(user, enabled): - frappe.set_value("Notification Settings", user, 'enabled', enabled) + if frappe.db.exists("Notification Settings", user): + frappe.set_value("Notification Settings", user, 'enabled', enabled) @frappe.whitelist() @@ -78,4 +79,4 @@ def get_permission_query_conditions(user): @frappe.whitelist() def set_seen_value(value, user): - frappe.db.set_value('Notification Settings', user, 'seen', value, update_modified=False) \ No newline at end of file + frappe.db.set_value('Notification Settings', user, 'seen', value, update_modified=False)