fix: payment entry rounding error

This commit is contained in:
Devin Slauenwhite
2023-11-18 15:09:44 +00:00
parent 8d4a19cecf
commit 49735bc120
2 changed files with 6 additions and 3 deletions

View File

@@ -829,7 +829,6 @@ frappe.ui.form.on('Payment Entry', {
else
total_negative_outstanding += Math.abs(flt(row.outstanding_amount));
})
var allocated_negative_outstanding = 0;
if (
(frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") ||
@@ -844,6 +843,7 @@ frappe.ui.form.on('Payment Entry', {
var allocated_positive_outstanding = paid_amount + allocated_negative_outstanding;
} else if (in_list(["Customer", "Supplier"], frm.doc.party_type)) {
total_negative_outstanding = flt(total_negative_outstanding, precision("outstanding_amount"))
if(paid_amount > total_negative_outstanding) {
if(total_negative_outstanding == 0) {
frappe.msgprint(

View File

@@ -913,8 +913,11 @@ class PaymentEntry(AccountsController):
):
return
total_negative_outstanding = sum(
total_negative_outstanding = flt(
sum(
abs(flt(d.outstanding_amount)) for d in self.get("references") if flt(d.outstanding_amount) < 0
),
self.references[0].precision("outstanding_amount") if self.references else None,
)
paid_amount = self.paid_amount if self.payment_type == "Receive" else self.received_amount