fix: on lead/deal creation error

This commit is contained in:
Shariq Ansari 2023-11-27 16:03:56 +05:30
parent 362266fe19
commit 9558017eb7
2 changed files with 10 additions and 10 deletions

View File

@ -141,7 +141,7 @@
/> />
<div v-else> <div v-else>
<div <div
v-if="section.contacts.length" v-if="section.contacts"
v-for="(contact, i) in section.contacts" v-for="(contact, i) in section.contacts"
:key="contact.name" :key="contact.name"
> >
@ -320,6 +320,10 @@ const reload = ref(false)
const showOrganizationModal = ref(false) const showOrganizationModal = ref(false)
const _organization = ref({}) const _organization = ref({})
const organization = computed(() => {
return deal.data?.organization && getOrganization(deal.data.organization)
})
function updateDeal(fieldname, value, callback) { function updateDeal(fieldname, value, callback) {
value = Array.isArray(fieldname) ? '' : value value = Array.isArray(fieldname) ? '' : value
@ -422,7 +426,7 @@ function getParsedFields(sections) {
let contactSection = { let contactSection = {
label: 'Contacts', label: 'Contacts',
opened: true, opened: true,
contacts: deal.data.contacts.map((contact) => { contacts: deal.data?.contacts.map((contact) => {
return { return {
name: contact.contact, name: contact.contact,
is_primary: contact.is_primary, is_primary: contact.is_primary,
@ -505,10 +509,6 @@ async function setPrimaryContact(contact) {
} }
} }
const organization = computed(() => {
return getOrganization(deal.data.organization)
})
function updateField(name, value, callback) { function updateField(name, value, callback) {
updateDeal(name, value, () => { updateDeal(name, value, () => {
deal.data[name] = value deal.data[name] = value

View File

@ -228,6 +228,10 @@ const reload = ref(false)
const showOrganizationModal = ref(false) const showOrganizationModal = ref(false)
const _organization = ref({}) const _organization = ref({})
const organization = computed(() => {
return lead.data?.organization && getOrganization(lead.data.organization)
})
function updateLead(fieldname, value, callback) { function updateLead(fieldname, value, callback) {
value = Array.isArray(fieldname) ? '' : value value = Array.isArray(fieldname) ? '' : value
@ -336,10 +340,6 @@ function getParsedFields(sections) {
return sections return sections
} }
const organization = computed(() => {
return getOrganization(lead.data.organization)
})
async function convertToDeal() { async function convertToDeal() {
let deal = await call('crm.fcrm.doctype.crm_lead.crm_lead.convert_to_deal', { let deal = await call('crm.fcrm.doctype.crm_lead.crm_lead.convert_to_deal', {
lead: lead.data.name, lead: lead.data.name,