[Fix] Valuation rate for serialized items (#15017)

This commit is contained in:
rohitwaghchaure 2018-07-27 10:33:30 +05:30 committed by Nabin Hait
parent e50e0e4b30
commit 0fe6ced99d

View File

@ -223,9 +223,10 @@ class update_entries_after(object):
tuple(serial_no))[0][0]) tuple(serial_no))[0][0])
new_stock_qty = self.qty_after_transaction + actual_qty new_stock_qty = self.qty_after_transaction + actual_qty
if new_stock_qty > 0: if new_stock_qty > 0:
new_stock_value = (self.qty_after_transaction * self.valuation_rate) + stock_value_change 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 # calculate new valuation rate only if stock value is positive
# else it remains the same as that of previous entry # else it remains the same as that of previous entry
self.valuation_rate = new_stock_value / new_stock_qty self.valuation_rate = new_stock_value / new_stock_qty