From 731efe3a958494126f21ed5a97e9a68052d7dce9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 3 Apr 2017 12:11:36 +0530 Subject: [PATCH] Minor fix in gross profit report --- erpnext/accounts/report/gross_profit/gross_profit.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index a79f98d895..4b28f1f35d 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -218,7 +218,8 @@ class GrossProfitGenerator(object): def get_average_buying_rate(self, row, item_code): if not item_code in self.average_buying_rate: if item_code in self.non_stock_items: - self.average_buying_rate[item_code] = flt(frappe.db.sql("""select sum(base_net_amount) / sum(qty * conversion_factor) + self.average_buying_rate[item_code] = flt(frappe.db.sql(""" + select sum(base_net_amount) / sum(qty * conversion_factor) from `tabPurchase Invoice Item` where item_code = %s and docstatus=1""", item_code)[0][0]) else: @@ -228,7 +229,7 @@ class GrossProfitGenerator(object): row.parenttype, row.parent, allow_zero_rate=True, currency=self.filters.currency) - self.average_buying_rate[item_code] = average_buying_rate + self.average_buying_rate[item_code] = flt(average_buying_rate) return self.average_buying_rate[item_code]