From bee3b40725b846a56b0ccf20f8a70324cd3a9749 Mon Sep 17 00:00:00 2001 From: Pawan Mehta Date: Mon, 22 Aug 2016 17:47:13 +0530 Subject: [PATCH] Update gross_profit.py --- .../report/gross_profit/gross_profit.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index 8be3c68621..a0528210c5 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -93,14 +93,14 @@ def get_columns(group_wise_columns, filters): class GrossProfitGenerator(object): def __init__(self, filters=None): - self.data = [] - self.average_buying_rate = {} - self.filters = frappe._dict(filters) - self.load_invoice_items() - self.load_stock_ledger_entries() - self.load_product_bundle() - self.load_non_stock_items() - self.process() + self.data = [] + self.average_buying_rate = {} + self.filters = frappe._dict(filters) + self.load_invoice_items() + self.load_stock_ledger_entries() + self.load_product_bundle() + self.load_non_stock_items() + self.process() def process(self): self.grouped = {} @@ -234,14 +234,13 @@ class GrossProfitGenerator(object): where a.item_code = %s and a.docstatus=1 and modified <= %s order by a.modified desc limit 1""", (item_code,self.filters.to_date)) - return flt(last_purchase_rate[0][0]) if last_purchase_rate else 0 else: last_purchase_rate = frappe.db.sql(""" select (a.base_rate / a.conversion_factor) from `tabPurchase Invoice Item` a where a.item_code = %s and a.docstatus=1 order by a.modified desc limit 1""", item_code) - return flt(last_purchase_rate[0][0]) if last_purchase_rate else 0 + return flt(last_purchase_rate[0][0]) if last_purchase_rate else 0 def load_invoice_items(self): conditions = ""