Milestone editor (popup)
Milestone editor (popup)
Phần tiêu đề “Milestone editor (popup)”Milestone là sự kiện trong vòng đời HĐ có thể gắn với % thanh toán. Vd “Ký HĐ → 30%”, “Bàn giao đất → 40%”, “Đi vào vận hành → 30%”.
Vị trí
Phần tiêu đề “Vị trí”Trên form Sale Order (Báo giá) hoặc Zone Contract (HĐ):
- Tab “Order Lines” → click 1 line → mở popup line detail
- Popup có tab “Milestones”
- HOẶC: click nút ”🎯 Sửa milestone” (dedicated modal - task #23)
Structure milestone
Phần tiêu đề “Structure milestone”sale.order.line.milestone (task #18-20)├── name: "Ký HĐ" / "Bàn giao đất" / ...├── description: Text mô tả├── date_planned: Ngày dự kiến├── date_actual: Ngày thực tế (khi hoàn thành)├── amount_pct: % thanh toán khi milestone hoàn thành├── amount_fixed: Số tiền cố định (thay vì %)├── state: draft / open / done / overdue / cancelled└── line_id: order line liên kếtTạo milestone manual
Phần tiêu đề “Tạo milestone manual”1. Mở popup
Phần tiêu đề “1. Mở popup”Click 1 order line → click nút ”🎯 Sửa milestone” → modal opens
2. Add milestone
Phần tiêu đề “2. Add milestone”Click ”+ Add” → điền:
- Name: “Ký HĐ”
- Date planned: (Đại chọn)
- Amount pct: 30 (nghĩa là 30% giá order line)
- State: draft
3. Save
Phần tiêu đề “3. Save”Milestone lưu, popup close. Order line hiển thị số milestone (vd “3 milestones”).
Apply template (nhanh)
Phần tiêu đề “Apply template (nhanh)”Đại có thể tạo milestone template sẵn dùng lại nhiều lần.
1. Tạo template (Admin, 1 lần)
Phần tiêu đề “1. Tạo template (Admin, 1 lần)”Cấu hình → Parkone → Milestone Templates → Mới
Preset chuẩn “50-30-20”:
- Ký HĐ: 50%, T+0
- Bàn giao: 30%, T+30
- Vận hành: 20%, T+90
2. Apply cho order line
Phần tiêu đề “2. Apply cho order line”Trên popup → click ”📋 Apply template” → chọn template
- Wizard mở với preview 3 milestones
- Adjust ngày cụ thể (auto-fill T+0/30/90 từ ngày HĐ)
- Click Apply → 3 milestones tạo sẵn
Xem chi tiết templates ở Milestone template presets.
Update state milestone
Phần tiêu đề “Update state milestone”Khi milestone hoàn thành (vd bàn giao đất xong):
- Mở popup milestone
- Click milestone → set:
- State:
done - Date actual: today (auto-fill)
- State:
- Save
Cron auto-sinh Invoice với amount = amount_pct × order_line.total_amount nếu milestone gắn payment.
Trạng thái milestone
Phần tiêu đề “Trạng thái milestone”| State | Ý nghĩa | Action |
|---|---|---|
| draft | Chưa bắt đầu | Sales rep set khi tạo |
| open | Đang thực hiện | Auto khi HĐ active + date_planned ≤ today |
| done | Đã hoàn thành | Manual set + auto-trigger Invoice |
| overdue | Quá hạn date_planned | Cron flag, activity to responsible |
| cancelled | Không thực hiện | Manual set nếu milestone bị bỏ |
Invoice trigger từ milestone
Phần tiêu đề “Invoice trigger từ milestone”Khi milestone → done:
- Cron detect (chạy 30 phút/lần) hoặc trigger ngay (nếu instant flag)
- Tính amount =
amount_pct × line.price_subtotalHOẶCamount_fixed - Tạo Invoice draft với 1 line: mô tả = milestone name, amount = tính trên
- Link Invoice ↔ milestone (field
invoice_id) - Activity to FC review + post
Milestone in Contract PDF
Phần tiêu đề “Milestone in Contract PDF”Contract PDF template có bảng render milestone schedule (task #71):
BẢNG THANH TOÁN THEO MỐC
| Mốc | Ngày dự kiến | % / Số tiền || Ký HĐ | 1/8/2026 | 30% = 1.5 tỷ || Bàn giao đất | 1/9/2026 | 40% = 2.0 tỷ || Vận hành | 1/12/2026 | 30% = 1.5 tỷ |Wizard render Contract → auto-fill bảng này từ milestones.
Milestone không link với billing_item — chỉ với order line?
Phần tiêu đề “Milestone không link với billing_item — chỉ với order line?”Milestone gắn với sale.order.line, không phải billing_item. Khi convert SO → HĐ, milestones migrate cùng.
Có thể có nhiều milestone cho 1 line không?
Phần tiêu đề “Có thể có nhiều milestone cho 1 line không?”Có. Line “Tiền cọc 5 tỷ” → 3 milestones 30/40/30 = 3 lần trả cho line này.
Tự động sinh Invoice khi milestone done — có thể tắt không?
Phần tiêu đề “Tự động sinh Invoice khi milestone done — có thể tắt không?”Có. Field auto_invoice trên milestone (Advanced) — set False → Invoice không auto sinh, FC sinh manual sau.
Milestone template khác milestone thường thế nào?
Phần tiêu đề “Milestone template khác milestone thường thế nào?”Template là “khuôn” reusable trong Cấu hình. Milestone thường là instance thực trên order line, có date + state cụ thể.
Template chỉ define name + amount_pct + delay_days. Apply → tạo milestones thực với date = HĐ date + delay_days.