From 22a46827a9352a5d0e2a57b1c5750ee9ddaf9878 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 13 Jun 2024 15:43:43 +0530 Subject: [PATCH] refactor: renamed get_quick_entry_fields and made it generic --- crm/api/doc.py | 6 +++--- frontend/src/components/Modals/ContactModal.vue | 4 ++-- frontend/src/components/Modals/DealModal.vue | 4 ++-- frontend/src/components/Modals/LeadModal.vue | 4 ++-- frontend/src/components/Modals/OrganizationModal.vue | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crm/api/doc.py b/crm/api/doc.py index 0c535e99..c1739280 100644 --- a/crm/api/doc.py +++ b/crm/api/doc.py @@ -158,10 +158,10 @@ def get_group_by_fields(doctype: str): @frappe.whitelist() -def get_quick_entry_fields(doctype: str): +def get_fields_layout(doctype: str, type: str): sections = [] - if frappe.db.exists("CRM Fields Layout", {"dt": doctype, "type": "Quick Entry"}): - layout = frappe.get_doc("CRM Fields Layout", {"dt": doctype, "type": "Quick Entry"}) + if frappe.db.exists("CRM Fields Layout", {"dt": doctype, "type": type}): + layout = frappe.get_doc("CRM Fields Layout", {"dt": doctype, "type": type}) else: return [] diff --git a/frontend/src/components/Modals/ContactModal.vue b/frontend/src/components/Modals/ContactModal.vue index 7ec75161..4e23756f 100644 --- a/frontend/src/components/Modals/ContactModal.vue +++ b/frontend/src/components/Modals/ContactModal.vue @@ -235,9 +235,9 @@ const detailFields = computed(() => { }) const sections = createResource({ - url: 'crm.api.doc.get_quick_entry_fields', + url: 'crm.api.doc.get_fields_layout', cache: ['quickEntryFields', 'Contact'], - params: { doctype: 'Contact' }, + params: { doctype: 'Contact', type: 'Quick Entry'}, auto: true, }) diff --git a/frontend/src/components/Modals/DealModal.vue b/frontend/src/components/Modals/DealModal.vue index bf465ddc..be2f7a72 100644 --- a/frontend/src/components/Modals/DealModal.vue +++ b/frontend/src/components/Modals/DealModal.vue @@ -77,9 +77,9 @@ const chooseExistingContact = ref(false) const chooseExistingOrganization = ref(false) const sections = createResource({ - url: 'crm.api.doc.get_quick_entry_fields', + url: 'crm.api.doc.get_fields_layout', cache: ['quickEntryFields', 'CRM Deal'], - params: { doctype: 'CRM Deal' }, + params: { doctype: 'CRM Deal', type: 'Quick Entry'}, auto: true, transform: (data) => { return data.forEach((section) => { diff --git a/frontend/src/components/Modals/LeadModal.vue b/frontend/src/components/Modals/LeadModal.vue index 54e7566e..a8245ffc 100644 --- a/frontend/src/components/Modals/LeadModal.vue +++ b/frontend/src/components/Modals/LeadModal.vue @@ -40,9 +40,9 @@ const error = ref(null) const isLeadCreating = ref(false) const sections = createResource({ - url: 'crm.api.doc.get_quick_entry_fields', + url: 'crm.api.doc.get_fields_layout', cache: ['quickEntryFields', 'CRM Lead'], - params: { doctype: 'CRM Lead' }, + params: { doctype: 'CRM Lead', type: 'Quick Entry' }, auto: true, transform: (data) => { return data.forEach((section) => { diff --git a/frontend/src/components/Modals/OrganizationModal.vue b/frontend/src/components/Modals/OrganizationModal.vue index 08a7e91a..d04205dc 100644 --- a/frontend/src/components/Modals/OrganizationModal.vue +++ b/frontend/src/components/Modals/OrganizationModal.vue @@ -225,9 +225,9 @@ const fields = computed(() => { }) const sections = createResource({ - url: 'crm.api.doc.get_quick_entry_fields', + url: 'crm.api.doc.get_fields_layout', cache: ['quickEntryFields', 'CRM Organization'], - params: { doctype: 'CRM Organization' }, + params: { doctype: 'CRM Organization', type: 'Quick Entry'}, auto: true, })