3.7 KiB
3.7 KiB
Task E.1: Quotation Stabilization Before Approval
Goal
Stabilize Quotation foundation before starting Task F: Approval Production Module.
Must Read
docs/implementation/task-a-template-audit.md
docs/implementation/task-b-template-audit.md
docs/implementation/task-b1-foundation-stabilization.md
docs/implementation/technical-debt.md
src/features/crm/quotations/**
src/features/foundation/**
src/db/schema.ts
Scope
ทำเฉพาะ stabilization:
- Review quotation master options
- Seed missing options
- Review quotation revision rule
- Review quotation totals rule
- Review approval readiness
- Update technical debt / ADR notes if needed
Part 1: Master Options Seed
ตรวจสอบและ seed เพิ่มถ้ายังไม่มี:
crm_quotation_type
crm_discount_type
crm_unit
crm_sent_via
crm_quotation_customer_role
crm_quotation_topic_type
ตัวอย่างค่า:
crm_quotation_type:
- crane
- dockdoor
- solarcell
- service
- other
crm_discount_type:
- percentage
- fixed
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
Rules:
- seed idempotent
- ห้าม hardcode organizationId
- update
foundation.seed.tsเท่านั้นถ้าเหมาะสม
Part 2: Form Option Review
ตรวจสอบ quotation form ว่า:
- status มาจาก master options
- quotationType มาจาก master options
- currency มาจาก master options
- discountType มาจาก master options
- unit มาจาก master options ถ้ามี item form
- customer role/topic type ไม่ hardcode ถ้าดึง option ได้ง่าย
Part 3: Revision Rule Review
ตรวจสอบและสรุป rule:
draft revise ได้ไหม
cancelled revise ได้ไหม
accepted revise ได้ไหม
rejected revise ได้ไหม
Recommendation:
draft: no
cancelled: no
accepted: yes
rejected: yes
sent: yes
approved: yes
ถ้า code ยังไม่ตรง ให้แก้เฉพาะ revision guard
Part 4: Approval Readiness
ตรวจสอบว่า quotation status รองรับ:
draft
pending_approval
approved
rejected
sent
accepted
lost
cancelled
revised
ยังไม่ต้องสร้าง approval table
ให้เพิ่ม placeholder action ได้เท่านั้นถ้าจำเป็น:
Submit for approval
แต่ action นี้ยังไม่ต้องทำ workflow จริง
Part 5: Documentation
อัปเดต:
docs/implementation/technical-debt.md
เพิ่ม/ยืนยันหัวข้อ:
- mixed tax rollup
- attachment storage
- revision snapshot
- CRM foreign keys
- approval workflow pending
ถ้ามี ADR folder ให้สร้าง note ได้:
docs/adr/0007-quotation-revision-strategy.md
docs/adr/0008-attachment-storage-strategy.md
ห้ามทำ
Approval table
Approval workflow
PDF generation
Dashboard KPI
Report
Notification
Output
สรุป:
- Files Added
- Files Modified
- Options Seeded
- Revision Rule Confirmed
- Approval Readiness
- Remaining Risks
- Task F Readiness
Definition of Done
Task E.1 ผ่านเมื่อ:
- quotation options seed ครบ
- quotation form ไม่ hardcode option สำคัญ
- revision guard ชัดเจน
- technical debt updated
- approval readiness confirmed
- ยังไม่สร้าง approval workflow จริง