fix: removed setuAssignees code

This commit is contained in:
Shariq Ansari 2025-06-06 14:00:39 +05:30
parent e214ce8bfb
commit 44df09fac2
7 changed files with 32 additions and 38 deletions

View File

@ -13,7 +13,6 @@ def get_deal(name):
deal["fields_meta"] = get_fields_meta("CRM Deal")
deal["_form_script"] = get_form_script("CRM Deal")
deal["_assign"] = get_assigned_users("CRM Deal", deal.name)
return deal

View File

@ -13,5 +13,4 @@ def get_lead(name):
lead["fields_meta"] = get_fields_meta("CRM Lead")
lead["_form_script"] = get_form_script("CRM Lead")
lead["_assign"] = get_assigned_users("CRM Lead", lead.name)
return lead

View File

@ -334,12 +334,7 @@ import Section from '@/components/Section.vue'
import SidePanelLayout from '@/components/SidePanelLayout.vue'
import SLASection from '@/components/SLASection.vue'
import CustomActions from '@/components/CustomActions.vue'
import {
openWebsite,
setupAssignees,
setupCustomizations,
copyToClipboard,
} from '@/utils'
import { openWebsite, setupCustomizations, copyToClipboard } from '@/utils'
import { getView } from '@/utils/view'
import { getSettings } from '@/stores/settings'
import { globalStore } from '@/stores/global'
@ -399,7 +394,6 @@ const deal = createResource({
organization.fetch()
}
setupAssignees(deal)
setupCustomizations(deal, {
doc: data,
$dialog,
@ -727,8 +721,8 @@ function openEmailBox() {
const { assignees, document } = useDocument('CRM Deal', props.dealId)
function reloadAssignees(changes) {
if (changes?.hasOwnProperty('lead_owner')) {
function reloadAssignees(data) {
if (data?.hasOwnProperty('deal_owner')) {
assignees.reload()
}
}

View File

@ -337,12 +337,7 @@ import SidePanelLayout from '@/components/SidePanelLayout.vue'
import FieldLayout from '@/components/FieldLayout/FieldLayout.vue'
import SLASection from '@/components/SLASection.vue'
import CustomActions from '@/components/CustomActions.vue'
import {
openWebsite,
setupAssignees,
setupCustomizations,
copyToClipboard,
} from '@/utils'
import { openWebsite, setupCustomizations, copyToClipboard } from '@/utils'
import { showQuickEntryModal, quickEntryProps } from '@/composables/modals'
import { getView } from '@/utils/view'
import { getSettings } from '@/stores/settings'
@ -405,7 +400,6 @@ const lead = createResource({
onSuccess: (data) => {
errorTitle.value = ''
errorMessage.value = ''
setupAssignees(lead)
setupCustomizations(lead, {
doc: data,
$dialog,
@ -717,8 +711,8 @@ function openQuickEntryModal() {
showConvertToDealModal.value = false
}
function reloadAssignees(changes) {
if (changes?.hasOwnProperty('lead_owner')) {
function reloadAssignees(data) {
if (data?.hasOwnProperty('lead_owner')) {
assignees.reload()
}
}

View File

@ -36,8 +36,8 @@
class="flex h-12 items-center justify-between gap-2 border-b px-3 py-2.5"
>
<AssignTo
v-model="deal.data._assignedTo"
:data="deal.data"
v-model="assignees.data"
:data="document.doc"
doctype="CRM Deal"
/>
<div class="flex items-center gap-2">
@ -66,6 +66,7 @@
doctype="CRM Deal"
:docname="deal.data.name"
@reload="sections.reload"
@afterFieldChange="reloadAssignees"
>
<template #actions="{ section }">
<div v-if="section.name == 'contacts_section'" class="pr-2">
@ -258,12 +259,13 @@ import Link from '@/components/Controls/Link.vue'
import SidePanelLayout from '@/components/SidePanelLayout.vue'
import SLASection from '@/components/SLASection.vue'
import CustomActions from '@/components/CustomActions.vue'
import { setupAssignees, setupCustomizations } from '@/utils'
import { setupCustomizations } from '@/utils'
import { getView } from '@/utils/view'
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,
@ -311,7 +313,6 @@ const deal = createResource({
organization.fetch()
}
setupAssignees(deal)
setupCustomizations(deal, {
doc: data,
$dialog,
@ -605,4 +606,12 @@ async function deleteDeal(name) {
})
router.push({ name: 'Deals' })
}
const { assignees, document } = useDocument('CRM Deal', props.dealId)
function reloadAssignees(data) {
if (data?.hasOwnProperty('deal_owner')) {
assignees.reload()
}
}
</script>

View File

@ -36,8 +36,8 @@
class="flex h-12 items-center justify-between gap-2 border-b px-3 py-2.5"
>
<AssignTo
v-model="lead.data._assignedTo"
:data="lead.data"
v-model="assignees.data"
:data="document.doc"
doctype="CRM Lead"
/>
<div class="flex items-center gap-2">
@ -71,6 +71,7 @@
doctype="CRM Lead"
:docname="lead.data.name"
@reload="sections.reload"
@afterFieldChange="reloadAssignees"
/>
</div>
</div>
@ -173,12 +174,13 @@ import Link from '@/components/Controls/Link.vue'
import SidePanelLayout from '@/components/SidePanelLayout.vue'
import SLASection from '@/components/SLASection.vue'
import CustomActions from '@/components/CustomActions.vue'
import { setupAssignees, setupCustomizations } from '@/utils'
import { setupCustomizations } from '@/utils'
import { getView } from '@/utils/view'
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,
@ -220,7 +222,6 @@ const lead = createResource({
params: { name: props.leadId },
cache: ['lead', props.leadId],
onSuccess: (data) => {
setupAssignees(lead)
setupCustomizations(lead, {
doc: data,
$dialog,
@ -454,4 +455,12 @@ async function convertToDeal() {
router.push({ name: 'Deal', params: { dealId: deal } })
}
}
const { assignees, document } = useDocument('CRM Lead', props.leadId)
function reloadAssignees(data) {
if (data?.hasOwnProperty('lead_owner')) {
assignees.reload()
}
}
</script>

View File

@ -211,16 +211,6 @@ export function validateEmail(email) {
return regExp.test(email)
}
export function setupAssignees(doc) {
let { getUser } = usersStore()
let assignees = doc.data?._assign || []
doc.data._assignedTo = assignees.map((user) => ({
name: user,
image: getUser(user).user_image,
label: getUser(user).full_name,
}))
}
export function parseAssignees(assignees) {
let { getUser } = usersStore()
return assignees.map((user) => ({