refactor: renamed get_quick_entry_fields and made it generic
This commit is contained in:
parent
145d26403f
commit
22a46827a9
@ -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 []
|
||||
|
||||
|
||||
@ -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,
|
||||
})
|
||||
|
||||
|
||||
@ -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) => {
|
||||
|
||||
@ -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) => {
|
||||
|
||||
@ -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,
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user