From ef770b593ac2bd88293ffe54cedd065ab04ec82f Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Thu, 29 Mar 2018 13:25:00 +0530 Subject: [PATCH] fix the item varint details --- .../report/item_variant_details/item_variant_details.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/report/item_variant_details/item_variant_details.py b/erpnext/stock/report/item_variant_details/item_variant_details.py index f1488f8eff..7379eb4e50 100644 --- a/erpnext/stock/report/item_variant_details/item_variant_details.py +++ b/erpnext/stock/report/item_variant_details/item_variant_details.py @@ -14,10 +14,15 @@ def get_data(item): if not item: return [] item_dicts = [] + variants = None variant_results = frappe.db.sql("""select name from `tabItem` where variant_of = %s""", item, as_dict=1) - variants = ",".join(['"' + frappe.db.escape(variant['name']) + '"' for variant in variant_results]) + if not variant_results: + frappe.msgprint(_("There isn't any item variant for the selected item")) + return [] + else: + variants = ",".join(['"' + frappe.db.escape(variant['name']) + '"' for variant in variant_results]) order_count_map = get_open_sales_orders_map(variants) stock_details_map = get_stock_details_map(variants)