From 67fdbcf2420c829246affa5b0b79a76cc3a38ae5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 28 Apr 2015 12:53:26 +0530 Subject: [PATCH] precision fixed in batch-wise balance report --- .../batch_wise_balance_history.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py index 1922d8a25e..03959879b9 100644 --- a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py +++ b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py @@ -8,20 +8,21 @@ from frappe.utils import flt, cint, getdate def execute(filters=None): if not filters: filters = {} + + float_precision = cint(frappe.db.get_default("float_precision")) or 3 columns = get_columns(filters) item_map = get_item_details(filters) - iwb_map = get_item_warehouse_batch_map(filters) + iwb_map = get_item_warehouse_batch_map(filters, float_precision) data = [] for item in sorted(iwb_map): for wh in sorted(iwb_map[item]): for batch in sorted(iwb_map[item][wh]): qty_dict = iwb_map[item][wh][batch] - data.append([item, item_map[item]["item_name"], - item_map[item]["description"], wh, batch, - qty_dict.opening_qty, qty_dict.in_qty, - qty_dict.out_qty, qty_dict.bal_qty + data.append([item, item_map[item]["item_name"], item_map[item]["description"], wh, batch, + flt(qty_dict.opening_qty, float_precision), flt(qty_dict.in_qty, float_precision), + flt(qty_dict.out_qty, float_precision), flt(qty_dict.bal_qty, float_precision) ]) return columns, data @@ -56,8 +57,7 @@ def get_stock_ledger_entries(filters): where docstatus < 2 %s order by item_code, warehouse""" % conditions, as_dict=1) -def get_item_warehouse_batch_map(filters): - float_precision = cint(frappe.db.get_default("float_precision")) or 3 +def get_item_warehouse_batch_map(filters, float_precision): sle = get_stock_ledger_entries(filters) iwb_map = {}