mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
@@ -404,44 +404,44 @@ def make_payment_request(**args):
|
|||||||
else ""
|
else ""
|
||||||
)
|
)
|
||||||
|
|
||||||
existing_payment_request = frappe.db.get_value(
|
draft_payment_request = frappe.db.get_value(
|
||||||
"Payment Request",
|
"Payment Request",
|
||||||
{"reference_doctype": args.dt, "reference_name": args.dn, "docstatus": ("!=", 2)},
|
{"reference_doctype": args.dt, "reference_name": args.dn, "docstatus": 0},
|
||||||
)
|
)
|
||||||
|
|
||||||
if existing_payment_request:
|
existing_payment_request_amount = get_existing_payment_request_amount(args.dt, args.dn)
|
||||||
|
|
||||||
|
if existing_payment_request_amount:
|
||||||
|
grand_total -= existing_payment_request_amount
|
||||||
|
|
||||||
|
if draft_payment_request:
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
"Payment Request", existing_payment_request, "grand_total", grand_total, update_modified=False
|
"Payment Request", draft_payment_request, "grand_total", grand_total, update_modified=False
|
||||||
)
|
)
|
||||||
pr = frappe.get_doc("Payment Request", existing_payment_request)
|
pr = frappe.get_doc("Payment Request", draft_payment_request)
|
||||||
else:
|
else:
|
||||||
if args.order_type != "Shopping Cart":
|
if args.order_type != "Shopping Cart":
|
||||||
existing_payment_request_amount = get_existing_payment_request_amount(args.dt, args.dn)
|
pr = frappe.new_doc("Payment Request")
|
||||||
|
pr.update(
|
||||||
if existing_payment_request_amount:
|
{
|
||||||
grand_total -= existing_payment_request_amount
|
"payment_gateway_account": gateway_account.get("name"),
|
||||||
|
"payment_gateway": gateway_account.get("payment_gateway"),
|
||||||
pr = frappe.new_doc("Payment Request")
|
"payment_account": gateway_account.get("payment_account"),
|
||||||
pr.update(
|
"payment_channel": gateway_account.get("payment_channel"),
|
||||||
{
|
"payment_request_type": args.get("payment_request_type"),
|
||||||
"payment_gateway_account": gateway_account.get("name"),
|
"currency": ref_doc.currency,
|
||||||
"payment_gateway": gateway_account.get("payment_gateway"),
|
"grand_total": grand_total,
|
||||||
"payment_account": gateway_account.get("payment_account"),
|
"mode_of_payment": args.mode_of_payment,
|
||||||
"payment_channel": gateway_account.get("payment_channel"),
|
"email_to": args.recipient_id or ref_doc.owner,
|
||||||
"payment_request_type": args.get("payment_request_type"),
|
"subject": _("Payment Request for {0}").format(args.dn),
|
||||||
"currency": ref_doc.currency,
|
"message": gateway_account.get("message") or get_dummy_message(ref_doc),
|
||||||
"grand_total": grand_total,
|
"reference_doctype": args.dt,
|
||||||
"mode_of_payment": args.mode_of_payment,
|
"reference_name": args.dn,
|
||||||
"email_to": args.recipient_id or ref_doc.owner,
|
"party_type": args.get("party_type") or "Customer",
|
||||||
"subject": _("Payment Request for {0}").format(args.dn),
|
"party": args.get("party") or ref_doc.get("customer"),
|
||||||
"message": gateway_account.get("message") or get_dummy_message(ref_doc),
|
"bank_account": bank_account,
|
||||||
"reference_doctype": args.dt,
|
}
|
||||||
"reference_name": args.dn,
|
)
|
||||||
"party_type": args.get("party_type") or "Customer",
|
|
||||||
"party": args.get("party") or ref_doc.get("customer"),
|
|
||||||
"bank_account": bank_account,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if args.order_type == "Shopping Cart" or args.mute_email:
|
if args.order_type == "Shopping Cart" or args.mute_email:
|
||||||
pr.flags.mute_email = True
|
pr.flags.mute_email = True
|
||||||
|
|||||||
Reference in New Issue
Block a user