From 28f8ed0fbd91d57cbb8eb3e09158d5f5267aa711 Mon Sep 17 00:00:00 2001 From: Sagar Vora <16315650+sagarvora@users.noreply.github.com> Date: Mon, 30 Jun 2025 23:51:45 +0530 Subject: [PATCH] perf: remove unnecessary `hasattr` call --- frappe/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index ec0f0ab58b..babde0f155 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -1602,7 +1602,7 @@ def copy_doc(doc: "Document", ignore_no_copy: bool = True) -> "Document": if not in_test: fields_to_clear.append("docstatus") - if isinstance(doc, BaseDocument) or hasattr(doc, "as_dict"): + if isinstance(doc, BaseDocument): d = doc.as_dict() elif isinstance(doc, MappingProxyType): # global test record d = dict(doc)