Back to Blog
วิธีสร้าง What is New Popup ใน Frappe App ด้วย Change Log
เรียนรู้วิธีใช้ Built-in Change Log Feature ของ Frappe เพื่อแสดง What is New Popup ให้ User เมื่อ App มีการ Update เวอร์ชัน

Frappe Framework มี Built-in Feature สำหรับแสดง "What's New" Popup Dialog ให้ User เมื่อพวกเขา Login หลังจาก App มีการ Update เวอร์ชัน Feature นี้ช่วยให้ User รู้ว่ามี Features ใหม่หรือ Bug Fixes อะไรบ้าง
วิธีการทำงาน
เมื่อ User Login หลังจาก App Update, Frappe จะ:
- ตรวจจับ Version Changes - เปรียบเทียบ
__version__ของ App กับ Version ที่เก็บไว้ - ค้นหา Change Log Files - หาไฟล์ที่ตรงกับ Version ใหม่
- แสดง Modal Dialog - Title "Updated To A New Version 🎉"
- แสดง Updates - จาก "Updates detailed" sections ใน Markdown Files
โครงสร้าง Directory
your_app/
├── your_app/
│ ├── __init__.py # มี __version__ = "x.y.z"
│ └── change_log/
│ ├── current/
│ │ ├── readme.md # Placeholder (จำเป็น)
│ │ └── changes.md # Placeholder ว่าง
│ ├── v0/ # Major Version 0.x.x
│ │ └── v0_9_2.md
│ └── v1/ # Major Version 1.x.x
│ ├── v1_0_0.md
│ ├── v1_1_0.md
│ └── v1_5_0.md
การตั้งชื่อไฟล์
- Directory:
v{major}/- Group ตาม Major Version - File:
v{major}_{minor}_{patch}.md- Version ด้วย Underscores - ตัวอย่าง: Version
1.5.0→v1/v1_5_0.md
รูปแบบ Markdown File
แต่ละ Version File ใช้ Format นี้:
# Updates detailed
- Feature description พร้อมคำอธิบายสั้นๆ
- อีก Feature หรือ Improvement
- Extended settings:
- Sub-feature 1
- Sub-feature 2
- Sub-feature 3
# Updates detailed
- Section ที่สองของ Updates (Optional)
- Features หรือ Fixes เพิ่มเติม
กฎ Format
- Title: ต้องเป็น
# Updates detailed(ตรงเป๊ะ) - Content: ใช้ Bullet Points ด้วย
- - Nested Items: ใช้ Tab +
-สำหรับ Sub-items - Multiple Sections: เพิ่ม
# Updates detailedHeading ได้หลายอัน - Emojis: Optional, ใส่ได้เช่น 🎉 📸 🔍
Quick Setup Commands
# สร้าง Directory Structure
mkdir -p your_app/change_log/v1 your_app/change_log/current
# สร้าง Placeholder Files
cat > your_app/change_log/current/readme.md << 'EOF'
Leave change log files in this folder for user release notes.
(this file is just a placeholder, don't delete it)
EOF
touch your_app/change_log/current/changes.md
# สร้าง Version File (ตัวอย่าง 1.5.0)
cat > your_app/change_log/v1/v1_5_0.md << 'EOF'
# Updates detailed
- Your feature description here
- Another update or improvement
EOF
ตัวอย่าง Version File
# Updates detailed
## Document Scanner - OCR Integration 🔍
- **Google Vision OCR Integration**: ทดสอบ OCR บน Scanned Documents
- Raw Text Extraction View
- Parsed Data JSON View
- Copy to Clipboard Button
- **Quick Scan Mode**: Pipeline แบบน้อยที่สุด
- Detect → Crop → Sharpen เท่านั้น
- ประมวลผลเร็วขึ้นสำหรับ Simple Documents
## Bug Fixes
- แก้ไข Deskew Threshold สำหรับ Document Straightening
- ปรับปรุง Luminance Merge ด้วย Conservative Clamping
Integration กับ Release Workflow
เมื่อใช้ Automated Release:
- ก่อน Release: สร้างไฟล์
v{major}_{minor}_{patch}.md - Version Bump: รัน Release Script
- Push:
git push --follow-tags - Users See: Popup เมื่อ Login หลัง Update
ตัวอย่าง Workflow
# 1. สร้าง Changelog File
cat > your_app/change_log/v1/v1_6_0.md << 'EOF'
# Updates detailed
- เพิ่ม Dark Mode Toggle
- ปรับปรุง Performance การโหลดหน้า
- แก้ไข Bug การ Export PDF
EOF
# 2. Commit
git add .
git commit -m "feat: add dark mode and fix PDF export"
# 3. Bump Version
yarn release:minor # หรือ npm version minor
# 4. Push
git push --follow-tags
ตรวจสอบ version ใน init.py
# your_app/__init__.py
__version__ = "1.6.0"
สำคัญ: Version ใน __init__.py ต้องตรงกับชื่อไฟล์ Changelog
Troubleshooting
Popup ไม่แสดง
- ตรวจสอบ File Naming:
v1_5_0.mdไม่ใช่v1.5.0.md - ตรวจสอบ
__version__: ใน__init__.pyต้องตรงกับ Version File - Clear Browser Cache: และ Re-login
- ตรวจสอบ Directory Structure: ต้องอยู่ใน
v{major}/Folder
Content ไม่ Render
- Heading ต้องถูก: ใช้
# Updates detailedเป๊ะ - Markdown Syntax: ใช้ Bullet Points
-ถูกต้อง - File Location: อยู่ใน
v{major}/Folder ที่ถูก
ตรวจสอบ Version ปัจจุบัน
# ใน bench console
bench --site your-site.local console
import your_app
print(your_app.__version__)
Multiple Apps
แต่ละ App ใน Bench สามารถมี Change Log ของตัวเองได้:
frappe-bench/
├── apps/
│ ├── frappe/
│ │ └── frappe/change_log/
│ ├── erpnext/
│ │ └── erpnext/change_log/
│ └── your_app/
│ └── your_app/change_log/
เมื่อ User Login หลัง Update, Frappe จะรวม Changelogs จากทุก Apps ที่มี Version Change
Best Practices
- เขียน Changelog ก่อน Release - เพื่อให้ Users รู้ว่ามีอะไรใหม่
- ใช้ Format ที่อ่านง่าย - Bullet Points สั้นๆ กระชับ
- แยก Features และ Bug Fixes - ใช้ Headings แยก Sections
- ใส่ Emojis - ช่วยให้ Changelog น่าอ่านขึ้น
- Semantic Versioning - Major.Minor.Patch
สรุป
Frappe's Built-in Change Log Feature ช่วยให้:
- แจ้ง Users เกี่ยวกับ Updates อัตโนมัติ
- ไม่ต้องส่ง Email หรือ Announcement แยก
- UX ดีขึ้น Users รู้ว่า App มีอะไรใหม่
สิ่งที่ต้องทำ:
- สร้าง
change_log/Directory Structure - สร้าง Markdown File ตาม Version
- ใช้
# Updates detailedHeading - Match Version กับ
__init__.py