fix: email_to, party_type and party are not set in payment request when order made from portal (#21084)
Co-authored-by: Anupam K <anupam@Anupams-MacBook-Air.local>
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index 0fade8c..7e9211a 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -317,13 +317,13 @@
"payment_request_type": args.get("payment_request_type"),
"currency": ref_doc.currency,
"grand_total": grand_total,
- "email_to": args.recipient_id or "",
+ "email_to": args.recipient_id or ref_doc.owner,
"subject": _("Payment Request for {0}").format(args.dn),
"message": gateway_account.get("message") or get_dummy_message(ref_doc),
"reference_doctype": args.dt,
"reference_name": args.dn,
- "party_type": args.get("party_type"),
- "party": args.get("party"),
+ "party_type": args.get("party_type") or "Customer",
+ "party": args.get("party") or ref_doc.customer,
"bank_account": bank_account
})