Bỏ qua để đến nội dung

5-tab Charts (Multi-view Dashboard)

Executive Dashboard đã upgrade với 5 tabs charts — visual drill-down thay vì chỉ KPI number.

Commit reference: 9445abf (task Batch 2).

KPI cards như dashboard cũ:

  • KCN, Lấp đầy %, Lô trống, HĐ hiệu lực, Khách thuê
  • Section Gia hạn (90/60/30/expired)
  • Section CSKH (SR mở, overdue)
  • Section Bảo trì (mở, BH, O&M, cảnh báo)

Chi tiết: Executive Dashboard.

Charts render SVG inline (không dùng chart library ngoài):

  • Fast load
  • Không cần OWL widget custom
  • Work với Odoo form view standard
  • Theme-aware (dark mode support future)

Model: parkone.dashboard.chart.mixin (AbstractModel) — shared giữa zone.dashboard + parkone.demo.dashboard.

  • Live compute mỗi lần open tab
  • Không cache (real-time)
  • Load time per tab: <1s
  • Total dashboard 5 tabs: ~2-3s first open

Time period + KCN filter (nếu có) apply cho tất cả tabs.

Vd filter “This quarter” → doanh thu 3 tháng, funnel 3 tháng, …

Mọi element (bar, donut segment, pie slice) show tooltip with:

  • Label
  • Value
  • Percentage (nếu applicable)
  • Bar tháng → mở list invoices của tháng đó
  • Donut KCN → mở form KCN
  • Pie warranty → mở list equipment status tương ứng
  • Row maintenance → mở request detail

Icon top-right mỗi tab:

  • 📊 Export data → CSV
  • 🖨️ Print → PDF page

Admin có thể:

  • Add tab mới (custom Python)
  • Modify chart colors (SCSS)
  • Change chart type (bar → line, donut → pie)

File source: models/parkone_dashboard_chart_mixin.py

Nếu KCN có 500+ equipment / 1000+ contracts:

  • Tab load 3-5s
  • Consider adding index PostgreSQL
  • Or aggregate table (materialized view)

Contact BSD support nếu cần optimize.

5-tab dashboard responsive:

  • Mobile: tabs vertical stack, chart smaller
  • Tablet: 2-column charts within tab
  • Desktop: full width
  • Data chưa có (KCN mới, chưa Invoice)
  • Filter quá strict (vd This week nhưng chưa có data tuần này)

Nới filter → verify.

Custom Python — extend zone.dashboard với:

financial_chart_html = fields.Html(compute='_compute_charts')
def _render_financial_chart(self):
# Custom SVG generation
...

Add <page string="💵 Financial"> vào XML view.

  • Sửa SCSS trong addons/parkone/static/src/parkone_demo_dashboard/parkone_demo_dashboard.scss
  • Rebuild assets
  • Deploy
Chia sẻ: