mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 18:04:46 +00:00
Merge pull request #50988 from frappe/mergify/bp/version-15-hotfix/pr-50968
This commit is contained in:
@@ -850,6 +850,7 @@ def update_payment_requests_as_per_pe_references(references=None, cancel=False):
|
|||||||
)
|
)
|
||||||
|
|
||||||
referenced_payment_requests = {pr.name: pr for pr in referenced_payment_requests}
|
referenced_payment_requests = {pr.name: pr for pr in referenced_payment_requests}
|
||||||
|
doc_updates = {}
|
||||||
|
|
||||||
for ref in references:
|
for ref in references:
|
||||||
if not ref.payment_request:
|
if not ref.payment_request:
|
||||||
@@ -875,7 +876,7 @@ def update_payment_requests_as_per_pe_references(references=None, cancel=False):
|
|||||||
title=_("Invalid Allocated Amount"),
|
title=_("Invalid Allocated Amount"),
|
||||||
)
|
)
|
||||||
|
|
||||||
# update status
|
# determine status
|
||||||
if new_outstanding_amount == payment_request["grand_total"]:
|
if new_outstanding_amount == payment_request["grand_total"]:
|
||||||
status = "Initiated" if payment_request["payment_request_type"] == "Outward" else "Requested"
|
status = "Initiated" if payment_request["payment_request_type"] == "Outward" else "Requested"
|
||||||
elif new_outstanding_amount == 0:
|
elif new_outstanding_amount == 0:
|
||||||
@@ -883,12 +884,15 @@ def update_payment_requests_as_per_pe_references(references=None, cancel=False):
|
|||||||
elif new_outstanding_amount > 0:
|
elif new_outstanding_amount > 0:
|
||||||
status = "Partially Paid"
|
status = "Partially Paid"
|
||||||
|
|
||||||
# update database
|
# prepare bulk update data
|
||||||
frappe.db.set_value(
|
doc_updates[ref.payment_request] = {
|
||||||
"Payment Request",
|
"outstanding_amount": new_outstanding_amount,
|
||||||
ref.payment_request,
|
"status": status,
|
||||||
{"outstanding_amount": new_outstanding_amount, "status": status},
|
}
|
||||||
)
|
|
||||||
|
# bulk update all payment requests
|
||||||
|
if doc_updates:
|
||||||
|
frappe.db.bulk_update("Payment Request", doc_updates)
|
||||||
|
|
||||||
|
|
||||||
def get_dummy_message(doc):
|
def get_dummy_message(doc):
|
||||||
|
|||||||
Reference in New Issue
Block a user