Merge pull request #16049 from rohitwaghchaure/incorrect_stock_value_difference_calculation

[Fix] Incorrect stock value difference because of negative stock
This commit is contained in:
Nabin Hait 2018-11-27 13:21:43 +05:30 committed by GitHub
commit b98d08a2cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,7 +176,11 @@ class update_entries_after(object):
# rounding as per precision # rounding as per precision
self.stock_value = flt(self.stock_value, self.precision) self.stock_value = flt(self.stock_value, self.precision)
stock_value_difference = self.stock_value - self.prev_stock_value if self.prev_stock_value < 0 and self.stock_value >= 0:
stock_value_difference = sle.actual_qty * self.valuation_rate
else:
stock_value_difference = self.stock_value - self.prev_stock_value
self.prev_stock_value = self.stock_value self.prev_stock_value = self.stock_value
# update current sle # update current sle