def get_notifications(self): """Get notifications for user""" notifications = frappe.desk.notifications.get_notifications() notifications = sorted(notifications.get("open_count_doctype", {}).items(), lambda a, b: 1 if a[1] < b[1] else -1) notifications = [{"key": n[0], "value": n[1], "link": get_url_to_list(n[0])} for n in notifications if n[1]] return notifications