From 0fe6ced99d05fae4aaad4ff385475997a2600c4a Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 27 Jul 2018 10:33:30 +0530 Subject: [PATCH] [Fix] Valuation rate for serialized items (#15017) --- erpnext/stock/stock_ledger.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 22db7f12ab..53267d64bc 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -223,9 +223,10 @@ class update_entries_after(object): tuple(serial_no))[0][0]) new_stock_qty = self.qty_after_transaction + actual_qty + if new_stock_qty > 0: new_stock_value = (self.qty_after_transaction * self.valuation_rate) + stock_value_change - if new_stock_value > 0: + if new_stock_value >= 0: # calculate new valuation rate only if stock value is positive # else it remains the same as that of previous entry self.valuation_rate = new_stock_value / new_stock_qty