From ab5e77ecf1b2edae7a0a98755535837a4467c72c Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 27 Nov 2017 11:26:13 +0530 Subject: [PATCH] [fix] do not pull disabled pos profiles (#11733) --- erpnext/accounts/doctype/pos_profile/pos_profile.py | 2 +- erpnext/stock/get_item_details.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py index 8d6a2db470f..79894f15fb1 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py @@ -19,7 +19,7 @@ class POSProfile(Document): def check_for_duplicate(self): res = frappe.db.sql("""select name, user from `tabPOS Profile` - where ifnull(user, '') = %s and name != %s and company = %s""", + where ifnull(user, '') = %s and name != %s and company = %s and ifnull(disabled, 0) != 1""", (self.user, self.name, self.company)) if res: if res[0][1]: diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 9ec5d195be9..c8e0b161859 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -363,11 +363,11 @@ def get_pos_profile_item_details(company, args, pos_profile=None): @frappe.whitelist() def get_pos_profile(company): pos_profile = frappe.db.sql("""select * from `tabPOS Profile` where user = %s - and company = %s""", (frappe.session['user'], company), as_dict=1) + and company = %s and ifnull(disabled,0) != 1""", (frappe.session['user'], company), as_dict=1) if not pos_profile: pos_profile = frappe.db.sql("""select * from `tabPOS Profile` - where ifnull(user,'') = '' and company = %s""", company, as_dict=1) + where ifnull(user,'') = '' and company = %s and ifnull(disabled,0) != 1""", company, as_dict=1) return pos_profile and pos_profile[0] or None