2.3 KiB
2.3 KiB
Task D.5.7 Opportunity / Quotation Synchronization Foundation
Summary
- Reused
opportunityIdas the active quotation link field. - Added service-side synchronization foundations instead of embedding sync logic in routes.
- Kept
Opportunityas sales pipeline source of truth. - Kept
Quotationas commercial document source of truth.
New Service Foundations
src/features/crm/opportunities/server/quotation-sync.service.tssyncOpportunityFromQuotationCreated()syncOpportunityFromQuotationApproval()syncOpportunityFromQuotationWon()syncOpportunityFromQuotationLost()
src/features/crm/quotations/server/opportunity-link.service.tsassertOpportunityLinkIntegrity()assertRevisionOpportunityLinkIntegrity()auditQuotationOpportunityLink()
Sync Trigger Map
- Quotation created
- Opportunity stage moves to
quotation_created - Outcome stays
open
- Opportunity stage moves to
- Quotation pending approval
- Opportunity stage stays
quotation_created
- Opportunity stage stays
- Quotation approved
- Opportunity stage moves to
negotiation
- Opportunity stage moves to
- Quotation sent to customer
- Opportunity stage can move to
negotiation
- Opportunity stage can move to
- Quotation won
- Opportunity stage becomes
closed - Opportunity outcome becomes
won
- Opportunity stage becomes
- Quotation lost
- Opportunity closes as
lostonly when no other viable quotation remains
- Opportunity closes as
Guard Rules
- Quotation cannot link to an opportunity outside the same organization.
- Closed opportunities cannot create new quotations.
- Quotation customer must match linked opportunity customer.
- Quotation product type must match linked opportunity product type.
- Revisions keep the same
opportunityId.
Audit Actions
sync_opportunity_from_quotation_createdsync_opportunity_from_quotation_approvedsync_opportunity_from_quotation_sentsync_opportunity_from_quotation_wonsync_opportunity_from_quotation_lostsync_quotation_opportunity_link
Current UI Integration
- Opportunity detail now shows richer linked quotation context.
- Quotation detail linkage foundation remains ready for follow-up UI expansion.
Known Limitations
- Manual quotation accept / reject operations are not fully exposed in UI yet.
- Opportunity detail shows linked quotations, but full quotation outcome highlighting can still be expanded.
- Quotation detail linked opportunity card can be extended further in a follow-up pass.