feat: Allow local translation as input for doctype (#33585)

* feat: allow local translation as input

* chore: remove translated var
This commit is contained in:
0xD0M1M0 2025-08-11 12:10:00 +02:00 committed by GitHub
parent 89da9934bc
commit 293f8f3d83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -79,6 +79,7 @@ def get_communication_doctype(doctype, txt, searchfield, start, page_len, filter
user_perms = frappe.utils.user.UserPermissions(frappe.session.user)
user_perms.build_permissions()
can_read = user_perms.can_read
from frappe import _
from frappe.modules import load_doctype_module
com_doctypes = []
@ -96,7 +97,15 @@ def get_communication_doctype(doctype, txt, searchfield, start, page_len, filter
d[0] for d in frappe.db.get_values("DocType", {"issingle": 0, "istable": 0, "hide_toolbar": 0})
]
return [[dt] for dt in com_doctypes if txt.lower().replace("%", "") in dt.lower() and dt in can_read]
results = []
txt_lower = txt.lower().replace("%", "")
for dt in com_doctypes:
if dt in can_read:
if txt_lower in dt.lower() or txt_lower in _(dt).lower():
results.append([dt])
return results
def sendmail(