1
0
forked from test/crm

refactor: set default values for new lead, deal and contact

(cherry picked from commit 71f764c224ebf43425da0adb2db4100e0a74aa6a)
This commit is contained in:
Shariq Ansari 2025-06-05 16:08:51 +05:30 committed by Mergify
parent 985c538044
commit f1032b5f93
3 changed files with 6 additions and 13 deletions

View File

@ -84,10 +84,6 @@ const loading = ref(false)
const { document: _contact } = useDocument('Contact')
if (Object.keys(_contact.doc).length != 0) {
_contact.doc = {}
}
async function createContact() {
if (_contact.doc.email_id) {
_contact.doc.email_ids = [{ email_id: _contact.doc.email_id }]
@ -155,7 +151,8 @@ const tabs = createResource({
})
onMounted(() => {
Object.assign(_contact.doc, props.contact.data || props.contact || {})
_contact.doc = {}
Object.assign(_contact.doc, props.contact.data || props.contact)
})
function openQuickEntryModal() {

View File

@ -96,10 +96,6 @@ const error = ref(null)
const { document: deal } = useDocument('CRM Deal')
if (Object.keys(deal.doc).length != 0) {
deal.doc = {}
}
const hasOrganizationSections = ref(true)
const hasContactSections = ref(true)
@ -241,7 +237,9 @@ function openQuickEntryModal() {
}
onMounted(() => {
deal.doc = { no_of_employees: '1-10' }
Object.assign(deal.doc, props.defaults)
if (!deal.doc.deal_owner) {
deal.doc.deal_owner = getUser().name
}

View File

@ -72,10 +72,6 @@ const isLeadCreating = ref(false)
const { document: lead } = useDocument('CRM Lead')
if (Object.keys(lead.doc).length != 0) {
lead.doc = {}
}
const leadStatuses = computed(() => {
let statuses = statusOptions('lead')
if (!lead.doc.status) {
@ -186,7 +182,9 @@ function openQuickEntryModal() {
}
onMounted(() => {
lead.doc = { no_of_employees: '1-10' }
Object.assign(lead.doc, props.defaults)
if (!lead.doc?.lead_owner) {
lead.doc.lead_owner = getUser().name
}