Merge branch 'develop'

This commit is contained in:
Nabin Hait 2017-04-03 13:18:14 +05:30
commit 9bfa0ab7eb
3 changed files with 8 additions and 8 deletions

View File

@ -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'''

View File

@ -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]

View File

@ -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)