diff --git a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py index 58f12162d14..f8d52a78336 100644 --- a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py @@ -15,12 +15,12 @@ class TestPOSProfile(unittest.TestCase): pos_profile = get_pos_profile("_Test Company") or {} if pos_profile: doc = frappe.get_doc("POS Profile", pos_profile.get("name")) - doc.append('item_groups', {'item_group': '_Test Item Group'}) - doc.append('customer_groups', {'customer_group': '_Test Customer Group'}) + doc.set('item_groups', [{'item_group': '_Test Item Group'}]) + doc.set('customer_groups', [{'customer_group': '_Test Customer Group'}]) doc.save() items = get_items_list(doc, doc.company) customers = get_customers_list(doc) - + products_count = frappe.db.sql(""" select count(name) from tabItem where item_group = '_Test Item Group'""", as_list=1) customers_count = frappe.db.sql(""" select count(name) from tabCustomer where customer_group = '_Test Customer Group'""") diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index c2f79841725..f371bd425c5 100755 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -189,6 +189,7 @@ def get_items_list(pos_profile, company): where i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1 {cond} + group by i.item_code """.format(cond=cond), tuple([company] + args_list), as_dict=1)