Skip to content

Commit

Permalink
Merge pull request #39468 from blaggacao/feat/payment-request-failure…
Browse files Browse the repository at this point in the history
…-reason
  • Loading branch information
barredterra authored Jan 30, 2024
2 parents f8a9554 + 00a915b commit 212d656
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions erpnext/accounts/doctype/payment_request/payment_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ frappe.ui.form.on("Payment Request", "onload", function(frm, dt, dn){
})

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(){
Expand Down
14 changes: 12 additions & 2 deletions erpnext/accounts/doctype/payment_request/payment_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"field_order": [
"payment_request_type",
"transaction_date",
"failed_reason",
"column_break_2",
"naming_series",
"mode_of_payment",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -433,4 +443,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ frappe.listview_settings['Payment Request'] = {
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"];
}
Expand Down

0 comments on commit 212d656

Please sign in to comment.