From 8c7b2f4d3cd374d1e51e083e850c7a71de0fbd06 Mon Sep 17 00:00:00 2001 From: pandiyan Date: Fri, 3 Jul 2026 18:25:01 +0530 Subject: [PATCH] fix: clear stray permission message when item dashboard has no warehouse access --- erpnext/stock/dashboard/item_dashboard.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/dashboard/item_dashboard.py b/erpnext/stock/dashboard/item_dashboard.py index 2acf8e3bbf3..9f628f8152f 100644 --- a/erpnext/stock/dashboard/item_dashboard.py +++ b/erpnext/stock/dashboard/item_dashboard.py @@ -17,6 +17,9 @@ def get_data( sort_order: str = "desc", ): """Return data to render the item dashboard""" + if not frappe.has_permission("Bin", "read"): + return [] + filters = [] if item_code: filters.append(["item_code", "=", item_code]) @@ -44,7 +47,10 @@ def get_data( if build_match_conditions("Warehouse", user=frappe.session.user): filters.append(["warehouse", "in", [w.name for w in frappe.get_list("Warehouse")]]) except frappe.PermissionError: - # user does not have access on warehouse + # user does not have access on warehouse; build_match_conditions already queued a + # "Not permitted" message via frappe.throw before this was caught, drop it so the + # client doesn't show a spurious error for a request that's failing gracefully here + frappe.clear_last_message() return [] items = frappe.db.get_all(