fix: adds check before enabling notification settings

This commit is contained in:
Parth Kharwar 2021-02-26 16:40:09 +05:30
parent 9e5ca78d78
commit a8d11f23d8

View file

@ -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)
frappe.db.set_value('Notification Settings', user, 'seen', value, update_modified=False)