diff --git a/erpnext/accounts/doctype/payment_request/payment_request.js b/erpnext/accounts/doctype/payment_request/payment_request.js index 5c7218608d..901ef1987b 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.js +++ b/erpnext/accounts/doctype/payment_request/payment_request.js @@ -25,7 +25,7 @@ frappe.ui.form.on("Payment Request", "onload", function(frm, dt, dn){ }) frappe.ui.form.on("Payment Request", "refresh", function(frm) { - if(frm.doc.payment_request_type == 'Inward' && frm.doc.payment_channel === "Phone" && + if(frm.doc.payment_request_type == 'Inward' && frm.doc.payment_channel !== "Phone" && !in_list(["Initiated", "Paid"], frm.doc.status) && !frm.doc.__islocal && frm.doc.docstatus==1){ frm.add_custom_button(__('Resend Payment Email'), function(){ frappe.call({ diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 6087ce29aa..43564d8267 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -729,3 +729,4 @@ erpnext.patches.v13_0.setting_custom_roles_for_some_regional_reports erpnext.patches.v13_0.rename_issue_doctype_fields erpnext.patches.v13_0.change_default_pos_print_format erpnext.patches.v13_0.set_youtube_video_id +erpnext.patches.v13_0.set_payment_channel_in_payment_gateway_account \ No newline at end of file diff --git a/erpnext/patches/v13_0/set_payment_channel_in_payment_gateway_account.py b/erpnext/patches/v13_0/set_payment_channel_in_payment_gateway_account.py new file mode 100644 index 0000000000..edca238393 --- /dev/null +++ b/erpnext/patches/v13_0/set_payment_channel_in_payment_gateway_account.py @@ -0,0 +1,17 @@ +from __future__ import unicode_literals +import frappe + +def execute(): + """Set the payment gateway account as Email for all the existing payment channel.""" + doc_meta = frappe.get_meta("Payment Gateway Account") + if doc_meta.get_field("payment_channel"): + return + + frappe.reload_doc("Accounts", "doctype", "Payment Gateway Account") + set_payment_channel_as_email() + +def set_payment_channel_as_email(): + frappe.db.sql(""" + UPDATE `tabPayment Gateway Account` + SET `payment_channel` = "Email" + """) \ No newline at end of file