task-e
This commit is contained in:
18
docs/adr/0007-quotation-revision-strategy.md
Normal file
18
docs/adr/0007-quotation-revision-strategy.md
Normal file
@@ -0,0 +1,18 @@
|
||||
Status:
|
||||
accepted
|
||||
|
||||
Context:
|
||||
Quotation revision was introduced in Task E, but the rules before approval workflow were still ambiguous.
|
||||
Task E.1 needs a stable rule so Task F can build approval on top without changing quotation lineage again.
|
||||
|
||||
Decision:
|
||||
- Revision is allowed only when the current quotation status is `approved`, `sent`, `accepted`, or `rejected`.
|
||||
- Revision is not allowed for `draft` or `cancelled`.
|
||||
- A new revision keeps the same quotation family using `parentQuotationId`.
|
||||
- A new revision copies header, items, customers, and topics only.
|
||||
- A new revision is created with the `revised` status when that master option exists.
|
||||
|
||||
Consequences:
|
||||
- Sales can revise commercially meaningful documents without reopening early drafts.
|
||||
- Approval work can later key off a stable quotation family and revision chain.
|
||||
- Follow-ups and attachments are still out of the revision snapshot and remain technical debt until explicitly designed.
|
||||
15
docs/adr/0008-attachment-storage-strategy.md
Normal file
15
docs/adr/0008-attachment-storage-strategy.md
Normal file
@@ -0,0 +1,15 @@
|
||||
Status:
|
||||
accepted
|
||||
|
||||
Context:
|
||||
Task E introduced quotation attachments as metadata only.
|
||||
Task E.1 confirms that approval should not start on top of an unstable file-storage design.
|
||||
|
||||
Decision:
|
||||
- Keep quotation attachments metadata-only for now.
|
||||
- Store file identity, original name, path, type, size, uploader, and timestamps in CRM tables.
|
||||
- Do not build upload transport, storage provider logic, signed download URLs, or binary retention policy in Task E or E.1.
|
||||
|
||||
Consequences:
|
||||
- Task F can reference attachment metadata without being blocked by storage implementation details.
|
||||
- A later storage task must define provider abstraction, permission checks, retention rules, and migration strategy for existing metadata rows.
|
||||
96
docs/implementation/task-e1-quotation-stabilization.md
Normal file
96
docs/implementation/task-e1-quotation-stabilization.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# Task E.1: Quotation Stabilization Before Approval
|
||||
|
||||
## 1. Files Added
|
||||
|
||||
- `docs/adr/0007-quotation-revision-strategy.md`
|
||||
- `docs/adr/0008-attachment-storage-strategy.md`
|
||||
|
||||
## 2. Files Modified
|
||||
|
||||
- `src/db/seeds/foundation.seed.ts`
|
||||
- `src/features/foundation/master-options/types.ts`
|
||||
- `src/features/crm/quotations/api/types.ts`
|
||||
- `src/features/crm/quotations/server/service.ts`
|
||||
- `src/features/crm/quotations/components/quotation-form-sheet.tsx`
|
||||
- `src/features/crm/quotations/components/quotation-detail.tsx`
|
||||
- `src/features/crm/enquiries/server/service.ts`
|
||||
- `docs/implementation/technical-debt.md`
|
||||
|
||||
## 3. Options Seeded
|
||||
|
||||
- `crm_quotation_type`
|
||||
- `crane`
|
||||
- `dockdoor`
|
||||
- `solarcell`
|
||||
- `service`
|
||||
- `other`
|
||||
- `crm_discount_type`
|
||||
- `fixed`
|
||||
- `percentage`
|
||||
- `crm_unit`
|
||||
- `pcs`
|
||||
- `set`
|
||||
- `lot`
|
||||
- `job`
|
||||
- `crm_sent_via`
|
||||
- `email`
|
||||
- `manual`
|
||||
- `system`
|
||||
- `crm_quotation_customer_role`
|
||||
- `owner`
|
||||
- `consultant`
|
||||
- `contractor`
|
||||
- `billing`
|
||||
- `crm_quotation_topic_type`
|
||||
- `scope`
|
||||
- `exclusion`
|
||||
- `payment`
|
||||
|
||||
## 4. Revision Rule Confirmed
|
||||
|
||||
- `draft`: cannot revise
|
||||
- `cancelled`: cannot revise
|
||||
- `accepted`: can revise
|
||||
- `rejected`: can revise
|
||||
- `sent`: can revise
|
||||
- `approved`: can revise
|
||||
|
||||
Implementation notes:
|
||||
|
||||
- revision guard now runs in quotation server service before a new revision is created
|
||||
- revision readiness is based on quotation status master-option code, not on UI-only conditions
|
||||
- new revision rows attempt to start with `revised` status when that option exists
|
||||
|
||||
## 5. Approval Readiness
|
||||
|
||||
- quotation status seed now explicitly supports:
|
||||
- `draft`
|
||||
- `pending_approval`
|
||||
- `approved`
|
||||
- `rejected`
|
||||
- `sent`
|
||||
- `accepted`
|
||||
- `lost`
|
||||
- `cancelled`
|
||||
- `revised`
|
||||
- quotation detail now exposes a placeholder `Submit for approval` action for `draft` and `revised` quotations
|
||||
- no approval table or approval workflow was added in Task E.1
|
||||
|
||||
## 6. Remaining Risks
|
||||
|
||||
- quotation summary still does not support mixed tax rollup from per-line tax strategies
|
||||
- attachments are still metadata-only and not backed by upload/storage plumbing
|
||||
- revision snapshot still excludes follow-ups and attachments
|
||||
- CRM entity relationships still rely on organization-scoped validation instead of database foreign keys
|
||||
- approval workflow is still pending and starts in Task F
|
||||
|
||||
## 7. Task F Readiness
|
||||
|
||||
- quotation forms now read status, quotation type, currency, discount type, unit, sent via, customer role, and topic type from master options instead of hardcoded UI choices where practical
|
||||
- quotation revision eligibility is explicit and server-enforced
|
||||
- approval-ready status vocabulary exists before approval workflow work begins
|
||||
- ADR notes now capture the revision and attachment strategies so Task F can build on stable assumptions
|
||||
|
||||
## 8. Verification
|
||||
|
||||
- `npx tsc --noEmit`
|
||||
@@ -115,3 +115,28 @@ Future:
|
||||
Priority:
|
||||
|
||||
* High
|
||||
|
||||
### 9. Approval Workflow Pending
|
||||
|
||||
Quotation stabilization in Task E.1 only prepares:
|
||||
|
||||
* approval-ready statuses
|
||||
* revision guard
|
||||
* placeholder submit-for-approval action
|
||||
|
||||
Current:
|
||||
|
||||
* no approval table
|
||||
* no approval requester/approver history
|
||||
* no multi-step approval rule
|
||||
* no approval notification
|
||||
|
||||
Future:
|
||||
|
||||
* introduce approval aggregate in Task F
|
||||
* separate workflow state from quotation commercial state where needed
|
||||
* define approver resolution by branch / amount / role
|
||||
|
||||
Priority:
|
||||
|
||||
* High
|
||||
|
||||
Reference in New Issue
Block a user