1
0
forked from test/crm
jcrm/crm/api/session.py
Shariq Ansari 20f3c089aa fix: create/update contact from lead and show on callui
also created contacts store which is used now everywhere
2023-08-28 21:52:21 +05:30

33 lines
812 B
Python

import frappe
@frappe.whitelist()
def get_users():
if frappe.session.user == "Guest":
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
users = frappe.qb.get_query(
"User",
fields=["name", "email", "enabled", "user_image", "full_name", "user_type"],
order_by="full_name asc",
distinct=True,
).run(as_dict=1)
for user in users:
if frappe.session.user == user.name:
user.session_user = True
return users
@frappe.whitelist()
def get_contacts():
if frappe.session.user == "Guest":
frappe.throw("Authentication failed", exc=frappe.AuthenticationError)
contacts = frappe.qb.get_query(
"Contact",
fields=['name', 'full_name', 'image', 'email_id', 'mobile_no', 'phone', 'salutation'],
order_by="first_name asc",
distinct=True,
).run(as_dict=1)
return contacts