diff --git a/frontend/src/components/Activities/Activities.vue b/frontend/src/components/Activities/Activities.vue
index 3842a6dc..29733580 100644
--- a/frontend/src/components/Activities/Activities.vue
+++ b/frontend/src/components/Activities/Activities.vue
@@ -365,7 +365,11 @@
{
+ if (JSON.stringify(updatedDoc[key]) !== JSON.stringify(oldDoc[key])) {
+ acc[key] = updatedDoc[key]
+ }
+ return acc
+ }, {})
+
+ document.save.submit(null, {
+ onSuccess: () => emit('afterSave', changes),
+ })
}
watch(
diff --git a/frontend/src/components/SidePanelLayout.vue b/frontend/src/components/SidePanelLayout.vue
index 9b794af9..3fe8fd1a 100644
--- a/frontend/src/components/SidePanelLayout.vue
+++ b/frontend/src/components/SidePanelLayout.vue
@@ -417,13 +417,13 @@ const props = defineProps({
},
})
+const emit = defineEmits(['afterFieldChange', 'reload'])
+
const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } =
getMeta(props.doctype)
const { isManager, getUser } = usersStore()
-const emit = defineEmits(['reload'])
-
const showSidePanelModal = ref(false)
let document = { doc: {} }
@@ -493,7 +493,13 @@ async function fieldChange(value, df) {
await triggerOnChange(df.fieldname)
- document.save.submit()
+ document.save.submit(null, {
+ onSuccess: () => {
+ emit('afterFieldChange', {
+ [df.fieldname]: value,
+ })
+ },
+ })
}
function parsedSection(section, editButtonAdded) {
diff --git a/frontend/src/pages/Deal.vue b/frontend/src/pages/Deal.vue
index 9d438146..dfc6b5c9 100644
--- a/frontend/src/pages/Deal.vue
+++ b/frontend/src/pages/Deal.vue
@@ -13,8 +13,8 @@
:actions="deal.data._customActions"
/>
@@ -134,6 +135,7 @@
doctype="CRM Deal"
:docname="deal.data.name"
@reload="sections.reload"
+ @afterFieldChange="reloadAssignees"
>
@@ -343,6 +345,7 @@ import { getSettings } from '@/stores/settings'
import { globalStore } from '@/stores/global'
import { statusesStore } from '@/stores/statuses'
import { getMeta } from '@/stores/meta'
+import { useDocument } from '@/data/document'
import { whatsappEnabled, callEnabled } from '@/composables/settings'
import {
createResource,
@@ -721,4 +724,12 @@ const activities = ref(null)
function openEmailBox() {
activities.value.emailBox.show = true
}
+
+const { assignees, document } = useDocument('CRM Deal', props.dealId)
+
+function reloadAssignees(changes) {
+ if (changes?.hasOwnProperty('lead_owner')) {
+ assignees.reload()
+ }
+}
diff --git a/frontend/src/pages/Lead.vue b/frontend/src/pages/Lead.vue
index f4755e0b..d4ca8ef4 100644
--- a/frontend/src/pages/Lead.vue
+++ b/frontend/src/pages/Lead.vue
@@ -13,8 +13,8 @@
:actions="lead.data._customActions"
/>
@@ -186,6 +187,7 @@
doctype="CRM Lead"
:docname="lead.data.name"
@reload="sections.reload"
+ @afterFieldChange="reloadAssignees"
/>
@@ -609,7 +611,10 @@ const existingOrganizationChecked = ref(false)
const existingContact = ref('')
const existingOrganization = ref('')
-const { triggerConvertToDeal } = useDocument('CRM Lead', props.leadId)
+const { triggerConvertToDeal, assignees, document } = useDocument(
+ 'CRM Lead',
+ props.leadId,
+)
async function convertToDeal() {
if (existingContactChecked.value && !existingContact.value) {
@@ -711,4 +716,10 @@ function openQuickEntryModal() {
}
showConvertToDealModal.value = false
}
+
+function reloadAssignees(changes) {
+ if (changes?.hasOwnProperty('lead_owner')) {
+ assignees.reload()
+ }
+}