From 8d15d284636bd8afc6502003a3e3a55ddc8f2a87 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 10 Mar 2025 19:00:13 +0530 Subject: [PATCH] fix: check permission on new doc (#31626) User might only have "only if creator" permission so checking on doctype will incorrectly flag it. Not sure if there's any better/simpler way to handle this. This is weird edge case on how files operate. --- frappe/handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/handler.py b/frappe/handler.py index 7f03e1db4f..6fe96e62a9 100644 --- a/frappe/handler.py +++ b/frappe/handler.py @@ -217,7 +217,7 @@ def check_write_permission(doctype: str | None = None, name: str | None = None): except frappe.DoesNotExistError: # doc has not been inserted yet, name is set to "new-some-doctype" # If doc inserts fine then only this attachment will be linked see file/utils.py:relink_mismatched_files - check_doctype_permission(doctype, "write") + frappe.new_doc(doctype).check_permission("write") return doc.check_permission("write")