Merge pull request #35157 from sokumon/auto-generate-fix

This commit is contained in:
Soham Kulkarni 2025-12-10 20:49:07 +05:30 committed by GitHub
commit 0424d2726c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -298,12 +298,15 @@ def get_module_info(module_name):
def choose_top_doctypes(doctype_names):
from frappe.model.utils import is_single_doctype
doctype_limit = 3
if len(doctype_names) > doctype_limit:
try:
doctype_count_map = {}
for doctype in doctype_names:
doctype_count_map[doctype] = frappe.db.count(doctype)
if not is_single_doctype(doctype):
doctype_count_map[doctype] = frappe.db.count(doctype)
top_doctypes = [
name
for name, count in sorted(doctype_count_map.items(), key=lambda x: x[1], reverse=True)[