refactor: method to get employee contact without permission check

(cherry picked from commit 58cdb9503b)
This commit is contained in:
Abdeali Chharchhoda
2025-12-19 11:39:02 +05:30
committed by Mergify
parent cb17dbd616
commit 773e56808a
2 changed files with 5 additions and 1 deletions

View File

@@ -300,7 +300,7 @@ def complete_contact_details(party_details):
contact_details = frappe._dict()
if party_details.party_type == "Employee":
from erpnext.setup.doctype.employee.employee import get_contact_details as get_employee_contact
from erpnext.setup.doctype.employee.employee import _get_contact_details as get_employee_contact
contact_details = get_employee_contact(party_details.party)
contact_details.update({"contact_person": None, "contact_phone": None})

View File

@@ -453,6 +453,10 @@ def get_contact_details(employee: str) -> dict:
frappe.has_permission("Employee", "read", employee, throw=True)
return _get_contact_details(employee)
def _get_contact_details(employee: str) -> dict:
contact_data = frappe.db.get_value(
"Employee",
employee,