fix: validate doctype before creating payment request

This commit is contained in:
Gursheen Anand 2024-01-09 11:33:52 +05:30
parent 62bbcbc7ef
commit bb421c8b07

View File

@ -424,6 +424,15 @@ def make_payment_request(**args):
"""Make payment request"""
args = frappe._dict(args)
if args.dt not in [
"Sales Order",
"Purchase Order",
"Sales Invoice",
"Purchase Invoice",
"POS Invoice",
"Fees",
]:
frappe.throw(_("Payment Requests cannot be created against: {0}").format(frappe.bold(args.dt)))
ref_doc = frappe.get_doc(args.dt, args.dn)
gateway_account = get_gateway_details(args) or frappe._dict()