fix: update onboarding status when lead is converted to deal
This commit is contained in:
parent
73bb4bd9f8
commit
4d74943ebc
@ -17,3 +17,15 @@ def update_user_onboarding_status(steps: str):
|
|||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
"User", frappe.session.user, "onboarding_status", json.dumps(onboarding_status), update_modified=False
|
"User", frappe.session.user, "onboarding_status", json.dumps(onboarding_status), update_modified=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_first_non_converted_lead():
|
||||||
|
lead = frappe.get_all(
|
||||||
|
"CRM Lead",
|
||||||
|
filters={"converted": 0},
|
||||||
|
fields=["name"],
|
||||||
|
order_by="creation",
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
return lead[0].name if lead else None
|
||||||
|
|||||||
@ -49,6 +49,18 @@ const steps = reactive([
|
|||||||
title: 'Convert lead to deal',
|
title: 'Convert lead to deal',
|
||||||
icon: markRaw(ConvertIcon),
|
icon: markRaw(ConvertIcon),
|
||||||
completed: false,
|
completed: false,
|
||||||
|
onClick: async () => {
|
||||||
|
minimize.value = true
|
||||||
|
|
||||||
|
let leadName = await call(
|
||||||
|
'crm.api.onboarding.get_first_non_converted_lead',
|
||||||
|
)
|
||||||
|
if (leadName) {
|
||||||
|
router.push({ name: 'Lead', params: { leadId: leadName } })
|
||||||
|
} else {
|
||||||
|
router.push({ name: 'Leads' })
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'create_first_note',
|
name: 'create_first_note',
|
||||||
|
|||||||
@ -348,6 +348,7 @@ import {
|
|||||||
callEnabled,
|
callEnabled,
|
||||||
isMobileView,
|
isMobileView,
|
||||||
} from '@/composables/settings'
|
} from '@/composables/settings'
|
||||||
|
import { useOnboarding } from '@/composables/onboarding'
|
||||||
import { capture } from '@/telemetry'
|
import { capture } from '@/telemetry'
|
||||||
import {
|
import {
|
||||||
createResource,
|
createResource,
|
||||||
@ -370,6 +371,7 @@ const { isManager } = usersStore()
|
|||||||
const { $dialog, $socket, makeCall } = globalStore()
|
const { $dialog, $socket, makeCall } = globalStore()
|
||||||
const { getContactByName, contacts } = contactsStore()
|
const { getContactByName, contacts } = contactsStore()
|
||||||
const { statusOptions, getLeadStatus, getDealStatus } = statusesStore()
|
const { statusOptions, getLeadStatus, getDealStatus } = statusesStore()
|
||||||
|
const { updateOnboardingStep } = useOnboarding()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
@ -658,6 +660,7 @@ async function convertToDeal(updated) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
if (_deal) {
|
if (_deal) {
|
||||||
|
updateOnboardingStep('convert_lead_to_deal')
|
||||||
capture('convert_lead_to_deal')
|
capture('convert_lead_to_deal')
|
||||||
if (updated) {
|
if (updated) {
|
||||||
await contacts.reload()
|
await contacts.reload()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user