diff --git a/frontend/src/pages/Deal.vue b/frontend/src/pages/Deal.vue
index b4acecf48..cb9b3dd87 100644
--- a/frontend/src/pages/Deal.vue
+++ b/frontend/src/pages/Deal.vue
@@ -141,7 +141,7 @@
/>
@@ -320,6 +320,10 @@ const reload = ref(false)
const showOrganizationModal = ref(false)
const _organization = ref({})
+const organization = computed(() => {
+ return deal.data?.organization && getOrganization(deal.data.organization)
+})
+
function updateDeal(fieldname, value, callback) {
value = Array.isArray(fieldname) ? '' : value
@@ -422,7 +426,7 @@ function getParsedFields(sections) {
let contactSection = {
label: 'Contacts',
opened: true,
- contacts: deal.data.contacts.map((contact) => {
+ contacts: deal.data?.contacts.map((contact) => {
return {
name: contact.contact,
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) {
updateDeal(name, value, () => {
deal.data[name] = value
diff --git a/frontend/src/pages/Lead.vue b/frontend/src/pages/Lead.vue
index 82176221c..366061353 100644
--- a/frontend/src/pages/Lead.vue
+++ b/frontend/src/pages/Lead.vue
@@ -228,6 +228,10 @@ const reload = ref(false)
const showOrganizationModal = ref(false)
const _organization = ref({})
+const organization = computed(() => {
+ return lead.data?.organization && getOrganization(lead.data.organization)
+})
+
function updateLead(fieldname, value, callback) {
value = Array.isArray(fieldname) ? '' : value
@@ -336,10 +340,6 @@ function getParsedFields(sections) {
return sections
}
-const organization = computed(() => {
- return getOrganization(lead.data.organization)
-})
-
async function convertToDeal() {
let deal = await call('crm.fcrm.doctype.crm_lead.crm_lead.convert_to_deal', {
lead: lead.data.name,