1
0
forked from test/crm

refactor: renamed get_quick_entry_fields and made it generic

This commit is contained in:
Shariq Ansari 2024-06-13 15:43:43 +05:30
parent 145d26403f
commit 22a46827a9
5 changed files with 11 additions and 11 deletions

View File

@ -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 []

View File

@ -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,
})

View File

@ -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) => {

View File

@ -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) => {

View File

@ -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,
})