From 3a972c4d8569bfb57b77b1db70d85ececfa93532 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 8 Jan 2018 12:35:05 +0530 Subject: [PATCH] Precision issue in stock reconciliation --- .../stock_reconciliation/stock_reconciliation.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 8c6e12ea94..73a7ef3931 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -55,7 +55,9 @@ class StockReconciliation(StockController): item.current_qty = qty item.current_valuation_rate = rate - self.difference_amount += (flt(item.qty) * flt(item.valuation_rate or rate) - (flt(qty) * flt(rate))) + self.difference_amount += (flt(item.qty, item.precision("qty")) * \ + flt(item.valuation_rate or rate, item.precision("valuation_rate")) \ + - flt(qty) * flt(rate)) return True items = filter(lambda d: _changed(d), self.items) @@ -197,8 +199,8 @@ class StockReconciliation(StockController): "company": self.company, "stock_uom": frappe.db.get_value("Item", row.item_code, "stock_uom"), "is_cancelled": "No", - "qty_after_transaction": row.qty, - "valuation_rate": row.valuation_rate + "qty_after_transaction": flt(row.qty, row.precision("qty")), + "valuation_rate": flt(row.valuation_rate, row.precision("valuation_rate")) }) self.make_sl_entries([args]) @@ -242,7 +244,7 @@ class StockReconciliation(StockController): def set_total_qty_and_amount(self): for d in self.get("items"): - d.amount = flt(d.qty) * flt(d.valuation_rate) + d.amount = flt(d.qty, d.precision("qty")) * flt(d.valuation_rate, d.precision("valuation_rate")) d.current_amount = flt(d.current_qty) * flt(d.current_valuation_rate) d.quantity_difference = flt(d.qty) - flt(d.current_qty) d.amount_difference = flt(d.amount) - flt(d.current_amount)