mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-25 14:11:45 +01:00
feat: retrieve employee basic contact information
(cherry picked from commit 4ad1474e32)
This commit is contained in:
committed by
Mergify
parent
ae733cd7ad
commit
4b2ac626c5
@@ -436,3 +436,28 @@ def has_upload_permission(doc, ptype="read", user=None):
|
|||||||
if get_doc_permissions(doc, user=user, ptype=ptype).get(ptype):
|
if get_doc_permissions(doc, user=user, ptype=ptype).get(ptype):
|
||||||
return True
|
return True
|
||||||
return doc.user_id == user
|
return doc.user_id == user
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_contact_details(employee: str) -> dict:
|
||||||
|
"""
|
||||||
|
Returns basic contact details for the given employee.
|
||||||
|
|
||||||
|
- employee_name as contact_display
|
||||||
|
- prefered_email as contact_email
|
||||||
|
- cell_number as contact_mobile
|
||||||
|
- designation as contact_designation
|
||||||
|
- department as contact_department
|
||||||
|
|
||||||
|
:param employee: Employee docname
|
||||||
|
"""
|
||||||
|
doc: Employee = frappe.get_doc("Employee", employee)
|
||||||
|
doc.check_permission()
|
||||||
|
|
||||||
|
return {
|
||||||
|
"contact_display": doc.get("employee_name"),
|
||||||
|
"contact_email": doc.get("prefered_email"),
|
||||||
|
"contact_mobile": doc.get("cell_number"),
|
||||||
|
"contact_designation": doc.get("designation"),
|
||||||
|
"contact_department": doc.get("department"),
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user