diff --git a/frappe/patches.txt b/frappe/patches.txt index 60c3112f4a..e70be0a37b 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -336,3 +336,4 @@ frappe.patches.v13_0.remove_twilio_settings frappe.patches.v12_0.rename_uploaded_files_with_proper_name frappe.patches.v13_0.queryreport_columns frappe.patches.v13_0.jinja_hook +frappe.patches.v13_0.update_notification_channel_if_empty diff --git a/frappe/patches/v13_0/update_notification_channel_if_empty.py b/frappe/patches/v13_0/update_notification_channel_if_empty.py new file mode 100644 index 0000000000..2c2a40e81b --- /dev/null +++ b/frappe/patches/v13_0/update_notification_channel_if_empty.py @@ -0,0 +1,15 @@ +# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors +# MIT License. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + + frappe.reload_doc("Email", "doctype", "Notification") + + notifications = frappe.get_all('Notification', {'is_standard': 1}, {'name', 'channel'}) + for notification in notifications: + if not notification.channel: + frappe.db.set_value("Notification", notification.name, "channel", "Email", update_modified=False) + frappe.db.commit()