diff --git a/erpnext/__init__.py b/erpnext/__init__.py index dc2a0fa278..5b6f359981 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '8.0.5' +__version__ = '8.0.6' def get_default_company(user=None): '''Get default company for user''' diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index 7dffd0a83e..4b28f1f35d 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -218,17 +218,18 @@ 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: average_buying_rate = get_incoming_rate(row) if not average_buying_rate: average_buying_rate = get_valuation_rate(item_code, row.warehouse, - row.parenttype, row.parent, allow_zero_rate=True, - currency=self.filters.currency) + 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] diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 958da16bac..9b4559e684 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -327,11 +327,10 @@ def get_pos_profile_item_details(company, args, pos_profile=None): @frappe.whitelist() def get_pos_profile(company): - condition = "and company = '%s'"%(company) if company else '' pos_profile = frappe.db.sql("""select * from `tabPOS Profile` where user = %s - {cond}""".format(cond=condition), (frappe.session['user']), as_dict=1) + and company = %s""", (frappe.session['user'], company), as_dict=1) - if not pos_profile and company: + if not pos_profile: pos_profile = frappe.db.sql("""select * from `tabPOS Profile` where ifnull(user,'') = '' and company = %s""", company, as_dict=1)