4.1 KiB
4.1 KiB
Task D.6.2 - Opportunity to Quotation Prefill & Project Timeline Fields
Objective
Improve the Opportunity -> Quotation workflow so users do not need to select the same Opportunity twice, while adding timeline fields and hot-project forecasting support.
Requirements
1. Create Quotation from Opportunity Detail
- Clicking
Create Quotationfrom Opportunity detail must open the quotation form with the current Opportunity already selected. - Related customer/project/contact/product context should be prefilled where available.
2. Add Project Timeline Fields
Add these fields to both Opportunity and Quotation:
Project Close DateDelivery Date
Rules:
- Use calendar date pickers.
- Display format must be
YYYY-MM-DD.
3. Auto Hot Project Rule
- When
Project Close Date <= current date + 3 months, the system should auto-suggesthotProject = true. - User may manually uncheck it.
4. Manual Override Rule
Hot Project must support:
auto suggestedmanual override
Recommended persisted fields:
isHotProjecthotProjectAutoSuggestedhotProjectManuallyOverridden
The UI must not keep forcing the checkbox back on during the same edit session after the user manually changes it.
5. Backend Enforcement
Backend must:
- accept
projectCloseDate - accept
deliveryDate - validate
YYYY-MM-DD - calculate hot-project suggestion
- preserve manual override
- persist all values correctly
6. Quotation Prefill Rules
When creating a quotation from an Opportunity, prefill where available:
opportunityId- customer / billing customer / project parties
- project name
- product type
- branch
- contact
projectCloseDatedeliveryDatehotProject
Do not overwrite user edits after the form has already been opened.
7. UI Requirements
Opportunity Detail:
Create Quotationmust pass the current Opportunity context.- Quotation form shows selected Opportunity already filled.
Opportunity Form:
Project Close DateDelivery DateHot Project
Quotation Form:
Project Close DateDelivery DateHot Project
8. Testing
Run:
npm run typecheck
npm run build
npm run audit:pdf
Test cases:
- Create quotation from Opportunity detail preselects Opportunity.
- User does not need to reselect Opportunity.
- Project Close Date within 3 months auto-checks Hot Project.
- User can uncheck Hot Project.
- Project Close Date beyond 3 months does not auto-check.
- Delivery Date saves correctly.
- Quotation receives timeline fields from Opportunity.
- Existing quotation create flow still works without Opportunity.
Acceptance Criteria
- Create Quotation from Opportunity detail preselects current Opportunity.
- Opportunity does not need to be selected twice.
- Opportunity has Project Close Date and Delivery Date.
- Quotation has Project Close Date and Delivery Date.
- Date fields use calendar pickers.
- Hot Project is auto-checked when Project Close Date is within 3 months.
- User can manually uncheck Hot Project.
- Manual override is preserved.
- Existing create/edit flows remain compatible.
- Typecheck, build, and PDF audit pass.
Implementation Result - 2026-07-01
Status: Completed
Summary:
- Added
Project Close DateandDelivery Dateto opportunity and quotation persistence, DTOs, validation, and form UI. - Added shared hot-project auto-suggestion logic plus persisted
hotProjectAutoSuggestedandhotProjectManuallyOverridden. - Updated opportunity detail
Create Quotationflow to pass current opportunity context into the quotation sheet, including project parties when already available. - Updated quotation prefill logic so automatic population no longer overwrites fields the user already edited in the same open session.
Verification:
npm run typecheckpassed.npm run buildpassed with existing Turbopack workspace-root and broad local storage path warnings.npm run audit:pdfpassed and refreshed PDF audit artifacts.
Implementation note: