fix: paid amount gets overwritten by get_outstanding_invoices (#20050)
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index adf47ed..2192b7b 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -652,14 +652,16 @@
(frm.doc.payment_type=="Receive" && frm.doc.party_type=="Student")
) {
if(total_positive_outstanding > total_negative_outstanding)
- frm.set_value("paid_amount",
- total_positive_outstanding - total_negative_outstanding);
+ if (!frm.doc.paid_amount)
+ frm.set_value("paid_amount",
+ total_positive_outstanding - total_negative_outstanding);
} else if (
total_negative_outstanding &&
total_positive_outstanding < total_negative_outstanding
) {
- frm.set_value("received_amount",
- total_negative_outstanding - total_positive_outstanding);
+ if (!frm.doc.received_amount)
+ frm.set_value("received_amount",
+ total_negative_outstanding - total_positive_outstanding);
}
}