From 3c322c1298ebc3625a1ae067851bb5cec1aa0152 Mon Sep 17 00:00:00 2001 From: shariquerik Date: Mon, 3 May 2021 19:35:21 +0530 Subject: [PATCH] fix: Patch Update Notification channel git status --- frappe/patches.txt | 1 + .../update_notification_channel_if_empty.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 frappe/patches/v13_0/update_notification_channel_if_empty.py 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..55128f0ac6 --- /dev/null +++ b/frappe/patches/v13_0/update_notification_channel_if_empty.py @@ -0,0 +1,16 @@ +# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors +# MIT License. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.utils.rename_field import rename_field + +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()