diff --git a/frappe/__init__.py b/frappe/__init__.py index 9444f3a518..7e958e57fd 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -968,7 +968,9 @@ def clear_cache(user: str | None = None, doctype: str | None = None): for fn in get_hooks("clear_cache"): get_attr(fn)() - frappe.utils.caching._SITE_CACHE.clear() + if (not doctype and not user) or doctype == "DocType": + frappe.utils.caching._SITE_CACHE.clear() + local.role_permissions = {} if hasattr(local, "request_cache"): local.request_cache.clear()