Skip to content

Conversation

@badal8381
Copy link

Summary

  • Replaced frappe.get_list() with count(*) field approach with frappe.db.count() for counting records
  • Fixes lead loading issues in the CRM portal

Problem

The CRM portal was failing to load leads due to the way record counts were being fetched. The previous implementation used:
frappe.get_list(doctype, filters=filters, fields="count(*) as total_count")[0].total_count

This approach can be unreliable and may fail in certain edge cases.

Solution

Replaced with the more robust and recommended Frappe API method:
frappe.db.count(doctype, filters=filters)

This change was applied in two locations within crm/api/doc.py:

  1. Kanban column count calculation (all_count)
  2. Total count for list view (total_count)

Test Plan

  • Verify leads load correctly in CRM portal
  • Verify Kanban view displays correct counts
  • Verify list view pagination works correctly

Replaced frappe.get_list with count(*) field approach with frappe.db.count()
which is more reliable for counting records and fixes lead loading issues
in the CRM portal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant