Fixed get_buying_amount in Gross Profit report:

To handle the case where there may be multiple invoices for a single delivery
This commit is contained in:
Saif Ur Rehman 2018-11-21 15:32:37 +05:00
parent 64b4d98778
commit 23eef11cf5

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: