Precision issue in stock reconciliation
This commit is contained in:
parent
4702cc0368
commit
3a972c4d85
@ -55,7 +55,9 @@ class StockReconciliation(StockController):
|
|||||||
|
|
||||||
item.current_qty = qty
|
item.current_qty = qty
|
||||||
item.current_valuation_rate = rate
|
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
|
return True
|
||||||
|
|
||||||
items = filter(lambda d: _changed(d), self.items)
|
items = filter(lambda d: _changed(d), self.items)
|
||||||
@ -197,8 +199,8 @@ class StockReconciliation(StockController):
|
|||||||
"company": self.company,
|
"company": self.company,
|
||||||
"stock_uom": frappe.db.get_value("Item", row.item_code, "stock_uom"),
|
"stock_uom": frappe.db.get_value("Item", row.item_code, "stock_uom"),
|
||||||
"is_cancelled": "No",
|
"is_cancelled": "No",
|
||||||
"qty_after_transaction": row.qty,
|
"qty_after_transaction": flt(row.qty, row.precision("qty")),
|
||||||
"valuation_rate": row.valuation_rate
|
"valuation_rate": flt(row.valuation_rate, row.precision("valuation_rate"))
|
||||||
})
|
})
|
||||||
self.make_sl_entries([args])
|
self.make_sl_entries([args])
|
||||||
|
|
||||||
@ -242,7 +244,7 @@ class StockReconciliation(StockController):
|
|||||||
|
|
||||||
def set_total_qty_and_amount(self):
|
def set_total_qty_and_amount(self):
|
||||||
for d in self.get("items"):
|
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.current_amount = flt(d.current_qty) * flt(d.current_valuation_rate)
|
||||||
d.quantity_difference = flt(d.qty) - flt(d.current_qty)
|
d.quantity_difference = flt(d.qty) - flt(d.current_qty)
|
||||||
d.amount_difference = flt(d.amount) - flt(d.current_amount)
|
d.amount_difference = flt(d.amount) - flt(d.current_amount)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user