fix: respect db multi_tenancy while fetching precision (#30301)
[skip ci]
diff --git a/erpnext/stock/report/stock_ageing/stock_ageing.py b/erpnext/stock/report/stock_ageing/stock_ageing.py
index 97a740e..7ca4003 100644
--- a/erpnext/stock/report/stock_ageing/stock_ageing.py
+++ b/erpnext/stock/report/stock_ageing/stock_ageing.py
@@ -12,7 +12,7 @@
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
Filters = frappe._dict
-precision = cint(frappe.db.get_single_value("System Settings", "float_precision"))
+
def execute(filters: Filters = None) -> Tuple:
to_date = filters["to_date"]
@@ -30,6 +30,8 @@
_func = itemgetter(1)
data = []
+ precision = cint(frappe.db.get_single_value("System Settings", "float_precision", cache=True))
+
for item, item_dict in item_details.items():
earliest_age, latest_age = 0, 0
details = item_dict["details"]
@@ -76,6 +78,9 @@
return flt(age_qty / total_qty, 2) if total_qty else 0.0
def get_range_age(filters: Filters, fifo_queue: List, to_date: str, item_dict: Dict) -> Tuple:
+
+ precision = cint(frappe.db.get_single_value("System Settings", "float_precision", cache=True))
+
range1 = range2 = range3 = above_range3 = 0.0
for item in fifo_queue: