fix: Patch Update Notification channel

git status
This commit is contained in:
shariquerik 2021-05-03 19:35:21 +05:30
parent 59e9a2520b
commit 3c322c1298
2 changed files with 17 additions and 0 deletions

View file

@ -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

View file

@ -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()