From 5a7a6a9bd5aa691cddeb832e484c9cbb4b09ca71 Mon Sep 17 00:00:00 2001 From: l0gesh29 Date: Thu, 16 Oct 2025 17:03:37 +0530 Subject: [PATCH] fix: recalculate amount based on allocated amount --- .../payment_reconciliation/payment_reconciliation.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js index c5b815b5e61..75a86318fbb 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js @@ -385,6 +385,16 @@ frappe.ui.form.on("Payment Reconciliation Allocation", { // filter payment let payment = frm.doc.payments.filter((x) => x.reference_name == row.reference_name); + let amount = payment[0].amount; + for (const d of frm.doc.allocation) { + if (row.reference_name == d.reference_name && amount) { + if (d.allocated_amount <= amount) { + d.amount = amount; + amount -= d.allocated_amount; + } + } + } + frm.call({ doc: frm.doc, method: "calculate_difference_on_allocation_change",