203 lines
3.7 KiB
Markdown
203 lines
3.7 KiB
Markdown
# Task E.1: Quotation Stabilization Before Approval
|
|
|
|
## Goal
|
|
|
|
Stabilize Quotation foundation before starting Task F: Approval Production Module.
|
|
|
|
## Must Read
|
|
|
|
```txt
|
|
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:
|
|
|
|
1. Review quotation master options
|
|
2. Seed missing options
|
|
3. Review quotation revision rule
|
|
4. Review quotation totals rule
|
|
5. Review approval readiness
|
|
6. Update technical debt / ADR notes if needed
|
|
|
|
## Part 1: Master Options Seed
|
|
|
|
ตรวจสอบและ seed เพิ่มถ้ายังไม่มี:
|
|
|
|
```txt
|
|
crm_quotation_type
|
|
crm_discount_type
|
|
crm_unit
|
|
crm_sent_via
|
|
crm_quotation_customer_role
|
|
crm_quotation_topic_type
|
|
```
|
|
|
|
ตัวอย่างค่า:
|
|
|
|
```txt
|
|
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:
|
|
|
|
```txt
|
|
draft revise ได้ไหม
|
|
cancelled revise ได้ไหม
|
|
accepted revise ได้ไหม
|
|
rejected revise ได้ไหม
|
|
```
|
|
|
|
Recommendation:
|
|
|
|
```txt
|
|
draft: no
|
|
cancelled: no
|
|
accepted: yes
|
|
rejected: yes
|
|
sent: yes
|
|
approved: yes
|
|
```
|
|
|
|
ถ้า code ยังไม่ตรง ให้แก้เฉพาะ revision guard
|
|
|
|
## Part 4: Approval Readiness
|
|
|
|
ตรวจสอบว่า quotation status รองรับ:
|
|
|
|
```txt
|
|
draft
|
|
pending_approval
|
|
approved
|
|
rejected
|
|
sent
|
|
accepted
|
|
lost
|
|
cancelled
|
|
revised
|
|
```
|
|
|
|
ยังไม่ต้องสร้าง approval table
|
|
|
|
ให้เพิ่ม placeholder action ได้เท่านั้นถ้าจำเป็น:
|
|
|
|
```txt
|
|
Submit for approval
|
|
```
|
|
|
|
แต่ action นี้ยังไม่ต้องทำ workflow จริง
|
|
|
|
## Part 5: Documentation
|
|
|
|
อัปเดต:
|
|
|
|
```txt
|
|
docs/implementation/technical-debt.md
|
|
```
|
|
|
|
เพิ่ม/ยืนยันหัวข้อ:
|
|
|
|
* mixed tax rollup
|
|
* attachment storage
|
|
* revision snapshot
|
|
* CRM foreign keys
|
|
* approval workflow pending
|
|
|
|
ถ้ามี ADR folder ให้สร้าง note ได้:
|
|
|
|
```txt
|
|
docs/adr/0007-quotation-revision-strategy.md
|
|
docs/adr/0008-attachment-storage-strategy.md
|
|
```
|
|
|
|
## ห้ามทำ
|
|
|
|
```txt
|
|
Approval table
|
|
Approval workflow
|
|
PDF generation
|
|
Dashboard KPI
|
|
Report
|
|
Notification
|
|
```
|
|
|
|
## Output
|
|
|
|
สรุป:
|
|
|
|
1. Files Added
|
|
2. Files Modified
|
|
3. Options Seeded
|
|
4. Revision Rule Confirmed
|
|
5. Approval Readiness
|
|
6. Remaining Risks
|
|
7. 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 จริง
|