From 3038ad8abe1cd90793962536a48bfab683862da3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Jun 2026 14:00:07 +0530 Subject: [PATCH] fix(sales_invoice): remove dead, non-functional POSService.get_warehouse get_warehouse could never run: it filtered POS Profile on a non-existent 'user' column (users live in the applicable_for_users child table), and embedded a Python bool (frappe.session["user"] == "") inside a query builder predicate, which raises before reaching the database. It also has no callers. Remove it and the now-unused msgprint import. --- .../doctype/sales_invoice/services/pos.py | 34 +------------------ 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/services/pos.py b/erpnext/accounts/doctype/sales_invoice/services/pos.py index 4fdcd46aa1d..aa4a44d7e39 100644 --- a/erpnext/accounts/doctype/sales_invoice/services/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/services/pos.py @@ -4,7 +4,7 @@ """POS helpers for Sales Invoice.""" import frappe -from frappe import _, msgprint +from frappe import _ from frappe.utils import cint, flt, get_link_to_form @@ -281,38 +281,6 @@ class POSService: if entry.amount > 0: frappe.throw(_("Row #{0} (Payment Table): Amount must be negative").format(entry.idx)) - def get_warehouse(self) -> str | None: - doc = self.doc - POSProfile = frappe.qb.DocType("POS Profile") - - user_query = ( - frappe.qb.from_(POSProfile) - .select(POSProfile.name, POSProfile.warehouse) - .where(POSProfile.company == doc.company) - .where( - (POSProfile.user == frappe.session["user"]) - | ((POSProfile.user.isnull() | (POSProfile.user == "")) & (frappe.session["user"] == "")) - ) - ) - user_pos_profile = user_query.run() - warehouse = user_pos_profile[0][1] if user_pos_profile else None - - if not warehouse: - global_query = ( - frappe.qb.from_(POSProfile) - .select(POSProfile.name, POSProfile.warehouse) - .where(POSProfile.company == doc.company) - .where(POSProfile.user.isnull() | (POSProfile.user == "")) - ) - global_pos_profile = global_query.run() - - if global_pos_profile: - warehouse = global_pos_profile[0][1] - elif not user_pos_profile: - msgprint(_("POS Profile required to make POS Entry"), raise_exception=True) - - return warehouse - def get_bank_cash_account(mode_of_payment: str, company: str) -> dict: account = frappe.db.get_value(