Merge pull request #16045 from SaiFi0102/GrossProfit-Fix-Buying-Amount-Multiple-Invoice

Fixed get_buying_amount in Gross Profit report:
This commit is contained in:
Nabin Hait 2018-11-26 19:55:06 +05:30 committed by GitHub
commit 4191d7eb52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -236,7 +236,7 @@ class GrossProfitGenerator(object):
previous_stock_value = len(my_sle) > i+1 and \
flt(my_sle[i+1].stock_value) or 0.0
if previous_stock_value:
return previous_stock_value - flt(sle.stock_value)
return (previous_stock_value - flt(sle.stock_value)) * flt(row.qty) / abs(flt(sle.qty))
else:
return flt(row.qty) * self.get_average_buying_rate(row, item_code)
else: