From 83bb3926b1aafd377ca217191dced34c69b9c76c Mon Sep 17 00:00:00 2001 From: NIYAZ RAZAK <76736615+niyazrazak@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:53:59 +0300 Subject: [PATCH 1/2] chore: consider currency precision --- erpnext/accounts/doctype/bank_clearance/bank_clearance.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/bank_clearance/bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/bank_clearance.py index 7f08653b15b..a09dc676553 100644 --- a/erpnext/accounts/doctype/bank_clearance/bank_clearance.py +++ b/erpnext/accounts/doctype/bank_clearance/bank_clearance.py @@ -48,6 +48,7 @@ class BankClearance(Document): entries = [] # get entries from all the apps + precision = cint(frappe.db.get_default("currency_precision")) or 2 for method_name in frappe.get_hooks("get_payment_entries_for_bank_clearance"): entries += ( frappe.get_attr(method_name)( @@ -76,8 +77,8 @@ class BankClearance(Document): if not d.get("account_currency"): d.account_currency = default_currency - - formatted_amount = fmt_money(abs(amount), 2, d.account_currency) + + formatted_amount = fmt_money(abs(amount), precision, d.account_currency) d.amount = formatted_amount + " " + (_("Dr") if amount > 0 else _("Cr")) d.posting_date = getdate(d.posting_date) From c889bdba0fe83d5d18aa60b3df576cf2a031cee8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 23 Jan 2025 16:39:03 +0530 Subject: [PATCH 2/2] chore: import statements and linter --- erpnext/accounts/doctype/bank_clearance/bank_clearance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/bank_clearance/bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/bank_clearance.py index a09dc676553..20920d66233 100644 --- a/erpnext/accounts/doctype/bank_clearance/bank_clearance.py +++ b/erpnext/accounts/doctype/bank_clearance/bank_clearance.py @@ -6,7 +6,7 @@ import frappe from frappe import _, msgprint from frappe.model.document import Document from frappe.query_builder.custom import ConstantColumn -from frappe.utils import flt, fmt_money, get_link_to_form, getdate +from frappe.utils import cint, flt, fmt_money, get_link_to_form, getdate from pypika import Order import erpnext @@ -77,7 +77,7 @@ class BankClearance(Document): if not d.get("account_currency"): d.account_currency = default_currency - + formatted_amount = fmt_money(abs(amount), precision, d.account_currency) d.amount = formatted_amount + " " + (_("Dr") if amount > 0 else _("Cr")) d.posting_date = getdate(d.posting_date)