From e1154090f66e3d204136b24a47f89ff97223e5fe Mon Sep 17 00:00:00 2001 From: ljain112 Date: Mon, 31 Mar 2025 12:37:28 +0530 Subject: [PATCH] fix: update outstanding with precision (cherry picked from commit aadda9f606748bb90cc24a4679e079d75cf29828) --- erpnext/accounts/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index ac37775f45f..b46e427382f 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -1854,14 +1854,17 @@ def update_voucher_outstanding(voucher_type, voucher_no, account, party_type, pa ): outstanding = voucher_outstanding[0] ref_doc = frappe.get_doc(voucher_type, voucher_no) + outstanding_amount = flt( + outstanding["outstanding_in_account_currency"], ref_doc.precision("outstanding_amount") + ) # Didn't use db_set for optimisation purpose - ref_doc.outstanding_amount = outstanding["outstanding_in_account_currency"] or 0.0 + ref_doc.outstanding_amount = outstanding_amount frappe.db.set_value( voucher_type, voucher_no, "outstanding_amount", - outstanding["outstanding_in_account_currency"] or 0.0, + outstanding_amount, ) ref_doc.set_status(update=True)