From e5d076d495efbc55023c4b8651b6e57a1c3ad8fb Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 31 May 2018 08:54:31 +0530 Subject: [PATCH] [minor][fix] fix query syntax (#14294) * [minor][fix] fix query syntax * Update pos.py --- erpnext/accounts/doctype/sales_invoice/pos.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index 86491f8a54..43a0d014b6 100755 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -158,9 +158,8 @@ def get_items_list(pos_profile, company): # Get items based on the item groups defined in the POS profile for d in pos_profile.get('item_groups'): args_list.extend([d.name for d in get_child_nodes('Item Group', d.item_group)]) - cond = "and i.item_group in (%s)" % (', '.join(['%s'] * len(args_list))) - - args_list = [company] + args_list + if args_list: + cond = "and i.item_group in (%s)" % (', '.join(['%s'] * len(args_list))) return frappe.db.sql(""" select @@ -172,7 +171,7 @@ def get_items_list(pos_profile, company): where i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1 {cond} - """.format(cond=cond), tuple(args_list), as_dict=1) + """.format(cond=cond), tuple([company] + args_list), as_dict=1) def get_item_groups(pos_profile):