From f509d13d2828af9f51023765a0ffc4abce140856 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Apr 2016 17:01:39 +0530 Subject: [PATCH] [fix] Get average selling rate based on group by --- erpnext/accounts/report/gross_profit/gross_profit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index ba87cf1c14..4ae0e6794d 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -145,11 +145,11 @@ class GrossProfitGenerator(object): self.data.append(row) if self.grouped: - self.collapse_group() + self.get_average_rate_based_on_group_by() else: self.grouped_data = [] - def collapse_group(self): + def get_average_rate_based_on_group_by(self): # sum buying / selling totals for group self.grouped_data = [] for key in self.grouped.keys(): @@ -166,6 +166,8 @@ class GrossProfitGenerator(object): if new_row.base_amount else 0 new_row.buying_rate = (new_row.buying_amount / new_row.qty) \ if new_row.qty else 0 + new_row.base_rate = (new_row.base_amount / new_row.qty) \ + if new_row.qty else 0 self.grouped_data.append(new_row)