From 988d5a66a42b205df6209df29f1e29d7f353c40e Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 15 Dec 2023 12:29:02 +0530 Subject: [PATCH] fix: get all lead/deal data in one api call --- crm/api/doc.py | 1 - crm/fcrm/doctype/crm_deal/api.py | 2 ++ crm/fcrm/doctype/crm_lead/api.py | 2 ++ frontend/src/pages/Deal.vue | 30 ++++++++++++++---------------- frontend/src/pages/Lead.vue | 21 ++++++++++----------- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/crm/api/doc.py b/crm/api/doc.py index dbadf320..335c511c 100644 --- a/crm/api/doc.py +++ b/crm/api/doc.py @@ -125,7 +125,6 @@ def get_list_data(doctype: str, filters: dict, order_by: str): } -@frappe.whitelist() def get_doctype_fields(doctype): not_allowed_fieldtypes = [ "Section Break", diff --git a/crm/fcrm/doctype/crm_deal/api.py b/crm/fcrm/doctype/crm_deal/api.py index a995e65a..5e1e562e 100644 --- a/crm/fcrm/doctype/crm_deal/api.py +++ b/crm/fcrm/doctype/crm_deal/api.py @@ -1,6 +1,7 @@ import frappe from frappe import _ +from crm.api.doc import get_doctype_fields @frappe.whitelist() def get_deal(name): @@ -25,4 +26,5 @@ def get_deal(name): fields=["contact", "is_primary"], ) + deal["doctype_fields"] = get_doctype_fields("CRM Deal") return deal diff --git a/crm/fcrm/doctype/crm_lead/api.py b/crm/fcrm/doctype/crm_lead/api.py index f51be6fa..26c58cff 100644 --- a/crm/fcrm/doctype/crm_lead/api.py +++ b/crm/fcrm/doctype/crm_lead/api.py @@ -1,6 +1,7 @@ import frappe from frappe import _ +from crm.api.doc import get_doctype_fields @frappe.whitelist() def get_lead(name): @@ -13,4 +14,5 @@ def get_lead(name): frappe.throw(_("Lead not found"), frappe.DoesNotExistError) lead = lead.pop() + lead["doctype_fields"] = get_doctype_fields("CRM Lead") return lead \ No newline at end of file diff --git a/frontend/src/pages/Deal.vue b/frontend/src/pages/Deal.vue index 34e89ba9..ff4b9aed 100644 --- a/frontend/src/pages/Deal.vue +++ b/frontend/src/pages/Deal.vue @@ -131,13 +131,16 @@ v-model="deal.data" @updateField="updateField" /> -
+