From db61deef7245b371322d141c3f5a1d7c385751b5 Mon Sep 17 00:00:00 2001 From: niraj gautam Date: Fri, 25 Aug 2023 19:35:32 +0530 Subject: [PATCH] fix: Avoid doc caching if `for_update` is set (#22203) * refactor: Avoid doc caching if for_update is set * chore: simplify condition --------- Co-authored-by: Ankush Menat --- frappe/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index 62292c9718..dd15329106 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -1254,7 +1254,7 @@ def get_doc(*args, **kwargs): doc = frappe.model.document.get_doc(*args, **kwargs) # Replace cache if stale one exists - if (key := can_cache_doc(args)) and cache.exists(key): + if not kwargs.get("for_update") and (key := can_cache_doc(args)) and cache.exists(key): _set_document_in_cache(key, doc) return doc