Precision issue in stock reconciliation

This commit is contained in:
Nabin Hait 2018-01-08 12:35:05 +05:30
parent 4702cc0368
commit 3a972c4d85

View File

@ -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)