From 8b298e463813743f0525baedb6a634980ce1998f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 15:34:55 +0000 Subject: [PATCH 1/2] Initial plan From 201cccbd62a7de379dc67b23c69aa8f7b758c1da Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 11:10:28 +0000 Subject: [PATCH 2/2] Replace len(frappe.get_list()) with frappe.db.count() for performance Co-authored-by: mrrobot47 <25586785+mrrobot47@users.noreply.github.com> --- next_crm/api/doc.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/next_crm/api/doc.py b/next_crm/api/doc.py index ce1ca6d3a1..56d441c8b6 100644 --- a/next_crm/api/doc.py +++ b/next_crm/api/doc.py @@ -499,10 +499,8 @@ def get_data( new_filters = filters.copy() new_filters.update({column_field: kc.get("name")}) - all_count = len( - frappe.get_list( - doctype, filters=convert_filter_to_tuple(doctype, new_filters) - ) + all_count = frappe.db.count( + doctype, filters=convert_filter_to_tuple(doctype, new_filters) ) kc["all_count"] = all_count @@ -620,7 +618,7 @@ def get_options(type, options): "page_length_count": page_length_count, "is_default": is_default, "views": get_views(doctype), - "total_count": len(frappe.get_list(doctype, filters=filters)), + "total_count": frappe.db.count(doctype, filters=filters), "row_count": len(data), "form_script": get_form_script(doctype), "list_script": get_form_script(doctype, "List"),