fix: Permission issue in Total Stock Summary report (#19110)

Data in "Total Stock Summary" report were not getting filtered
based on applied user permissions because some link fields had
wrong options
This commit is contained in:
Suraj Shetty 2019-09-19 11:13:22 +05:30 committed by Anurag Mishra
parent 8a097c8627
commit 28d182af15

View File

@ -15,8 +15,8 @@ def execute(filters=None):
def get_columns():
columns = [
_("Company") + ":Link/Item:250",
_("Warehouse") + ":Link/Item:150",
_("Company") + ":Link/Company:250",
_("Warehouse") + ":Link/Warehouse:150",
_("Item") + ":Link/Item:150",
_("Description") + "::300",
_("Current Qty") + ":Float:100",
@ -30,7 +30,7 @@ def get_total_stock(filters):
if filters.get("group_by") == "Warehouse":
if filters.get("company"):
conditions += " AND warehouse.company = %s" % frappe.db.escape(filters.get("company"), percent=False)
conditions += " AND warehouse.company = '%s'" % frappe.db.escape(filters.get("company"), percent=False)
conditions += " GROUP BY ledger.warehouse, item.item_code"
columns += "'' as company, ledger.warehouse"