fix: precision issue

(cherry picked from commit 69bee93bfd)
This commit is contained in:
Rohit Waghchaure
2025-05-05 15:23:56 +05:30
committed by Mergify
parent f4551bb918
commit b6908a79bd
2 changed files with 2 additions and 2 deletions

View File

@@ -1314,7 +1314,7 @@ class TestStockLedgerEntry(FrappeTestCase, StockTestMixin):
# To deliver 100 qty we fall short of 11.0073 qty (11.007 with precision 3)
# Stock up with 11.007 (balance in db becomes 99.9997, on UI it will show as 100)
make_stock_entry(item_code=item_code, target=warehouse, qty=11.007, rate=100)
self.assertEqual(get_stock_balance(item_code, warehouse), 99.9997)
self.assertEqual(get_stock_balance(item_code, warehouse), 100.0)
# See if delivery note goes through
# Negative qty error should not be raised as 99.9997 is 100 with precision 3 (system precision)

View File

@@ -894,7 +894,7 @@ class update_entries_after:
self.wh_data.prev_stock_value = self.wh_data.stock_value
# update current sle
sle.qty_after_transaction = self.wh_data.qty_after_transaction
sle.qty_after_transaction = flt(self.wh_data.qty_after_transaction, self.flt_precision)
sle.valuation_rate = self.wh_data.valuation_rate
sle.stock_value = self.wh_data.stock_value
sle.stock_queue = json.dumps(self.wh_data.stock_queue)