fix: payment entry rounding error
This commit is contained in:
@@ -829,7 +829,6 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
else
|
else
|
||||||
total_negative_outstanding += Math.abs(flt(row.outstanding_amount));
|
total_negative_outstanding += Math.abs(flt(row.outstanding_amount));
|
||||||
})
|
})
|
||||||
|
|
||||||
var allocated_negative_outstanding = 0;
|
var allocated_negative_outstanding = 0;
|
||||||
if (
|
if (
|
||||||
(frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") ||
|
(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;
|
var allocated_positive_outstanding = paid_amount + allocated_negative_outstanding;
|
||||||
} else if (in_list(["Customer", "Supplier"], frm.doc.party_type)) {
|
} 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(paid_amount > total_negative_outstanding) {
|
||||||
if(total_negative_outstanding == 0) {
|
if(total_negative_outstanding == 0) {
|
||||||
frappe.msgprint(
|
frappe.msgprint(
|
||||||
|
|||||||
@@ -913,8 +913,11 @@ class PaymentEntry(AccountsController):
|
|||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
total_negative_outstanding = sum(
|
total_negative_outstanding = flt(
|
||||||
abs(flt(d.outstanding_amount)) for d in self.get("references") if flt(d.outstanding_amount) < 0
|
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
|
paid_amount = self.paid_amount if self.payment_type == "Receive" else self.received_amount
|
||||||
|
|||||||
Reference in New Issue
Block a user