Merge pull request #39468 from blaggacao/feat/payment-request-failure-reason
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.js b/erpnext/accounts/doctype/payment_request/payment_request.js
index e913912..c85cd42 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.js
+++ b/erpnext/accounts/doctype/payment_request/payment_request.js
@@ -25,6 +25,10 @@
})
frappe.ui.form.on("Payment Request", "refresh", function(frm) {
+ if(frm.doc.status == 'Failed'){
+ frm.set_intro(__("Failure: {0}", [frm.doc.failed_reason]), "red");
+ }
+
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(){
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.json b/erpnext/accounts/doctype/payment_request/payment_request.json
index 66b5c4b..f62b624 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.json
+++ b/erpnext/accounts/doctype/payment_request/payment_request.json
@@ -7,6 +7,7 @@
"field_order": [
"payment_request_type",
"transaction_date",
+ "failed_reason",
"column_break_2",
"naming_series",
"mode_of_payment",
@@ -389,13 +390,22 @@
"options": "Payment Request",
"print_hide": 1,
"read_only": 1
+ },
+ {
+ "fieldname": "failed_reason",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "label": "Reason for Failure",
+ "no_copy": 1,
+ "print_hide": 1,
+ "read_only": 1
}
],
"in_create": 1,
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
- "modified": "2023-09-27 09:51:42.277638",
+ "modified": "2024-01-20 00:37:06.988919",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Request",
@@ -433,4 +443,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"states": []
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/doctype/payment_request/payment_request_list.js b/erpnext/accounts/doctype/payment_request/payment_request_list.js
index 85d729c..43f7856 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request_list.js
+++ b/erpnext/accounts/doctype/payment_request/payment_request_list.js
@@ -16,6 +16,9 @@
else if(doc.status == "Paid") {
return [__("Paid"), "blue", "status,=,Paid"];
}
+ else if(doc.status == "Failed") {
+ return [__("Failed"), "red", "status,=,Failed"];
+ }
else if(doc.status == "Cancelled") {
return [__("Cancelled"), "red", "status,=,Cancelled"];
}