mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
refactor: use get_value instead of exists
This commit is contained in:
committed by
Ankush Menat
parent
5c4eabf075
commit
f37316a266
@@ -225,9 +225,7 @@ def _check_agent_availability(agent_email, scheduled_time):
|
||||
|
||||
|
||||
def _get_employee_from_user(user):
|
||||
employee_docname = frappe.db.exists(
|
||||
{'doctype': 'Employee', 'user_id': user})
|
||||
employee_docname = frappe.db.get_value('Employee', {'user_id': user})
|
||||
if employee_docname:
|
||||
# frappe.db.exists returns a tuple of a tuple
|
||||
return frappe.get_doc('Employee', employee_docname)
|
||||
return None
|
||||
|
||||
@@ -8,7 +8,7 @@ import frappe
|
||||
|
||||
|
||||
def create_test_lead():
|
||||
test_lead = frappe.db.exists({"doctype": "Lead", "email_id": "test@example.com"})
|
||||
test_lead = frappe.db.get_value("Lead", {"email_id": "test@example.com"})
|
||||
if test_lead:
|
||||
return frappe.get_doc("Lead", test_lead)
|
||||
test_lead = frappe.get_doc(
|
||||
@@ -19,15 +19,6 @@ def create_test_lead():
|
||||
|
||||
|
||||
def create_test_appointments():
|
||||
test_appointment = frappe.db.exists(
|
||||
{
|
||||
"doctype": "Appointment",
|
||||
"scheduled_time": datetime.datetime.now(),
|
||||
"email": "test@example.com",
|
||||
}
|
||||
)
|
||||
if test_appointment:
|
||||
return frappe.get_doc("Appointment", test_appointment)
|
||||
test_appointment = frappe.get_doc(
|
||||
{
|
||||
"doctype": "Appointment",
|
||||
|
||||
Reference in New Issue
Block a user