Dashboard Views
Dashboard views provide a configurable home screen with KPI cards, charts, lists, and goal widgets. The system supports a Standard dashboard (read-only, defined by modules) and personal dashboards (user-created, fully editable).
Architecture
Section titled “Architecture”Standard Dashboard
Section titled “Standard Dashboard”The Standard dashboard is computed on-the-fly from the view architecture. It is never saved to the database and is always read-only. Each module contributes widgets via view inheritance, so the Standard dashboard automatically reflects all installed modules.
Users see only widgets matching their security groups.
Personal Dashboards
Section titled “Personal Dashboards”Users can create personal dashboards stored in the DashboardPreference model. Personal dashboards support:
- Drag-and-drop widget repositioning
- Widget resizing
- Adding/removing widgets
- Renaming and deleting dashboards
Each user’s dashboards are private (enforced by a RecordRule).
Defining a Dashboard View
Section titled “Defining a Dashboard View”The base dashboard is defined in the core module:
- data_type: UiView name: Home Dashboard identifier: home_dashboard_view type: Dashboard model: DashboardPreference arch: - type: row anchor: dashboard_greeting content: - type: column span: 12 content: - type: widget widget: Greeting groups: - core_internal properties: title: Welcome showDate: true showIcon: true - type: row anchor: dashboard_core_kpis content: - type: column span: 3 content: - type: widget widget: KPICard groups: - core_internal properties: title: Contacts model: Contact mode: count filter: (Q(active=True)) label: Active Contacts icon: Users color: blueLayout System
Section titled “Layout System”Dashboard arch uses rows and columns like form views:
| Element | Description |
|---|---|
row | Horizontal container. Use anchor for stable inheritance targeting. |
column | Grid column with span (1-12). |
widget | Dashboard widget with widget type, groups, and properties. |
Widget Element
Section titled “Widget Element”- type: widget widget: KPICard # Widget type groups: # Access control (optional) - sales_user_group properties: # Widget-specific configuration model: SaleOrder mode: count filter: (Q(state='Confirmed')) label: Sales Orders icon: ShoppingCart color: blueAdding Module Widgets via Inheritance
Section titled “Adding Module Widgets via Inheritance”Modules add widgets to the Standard dashboard using view inheritance. Always add an anchor to your rows for other modules to target.
- depends: - ../security/security.yaml data_type: UiView name: Home Dashboard - Sales identifier: home_dashboard_sales type: Dashboard model: DashboardPreference inherited_view: home_dashboard_view arch: operations: - action: add target: anchor: dashboard_core_kpis position: after value: type: row anchor: dashboard_sales_kpis content: - type: column span: 3 content: - type: widget widget: KPICard groups: - sales_user_group properties: title: Quotations model: SaleOrder mode: count filter: (Q(state='Quote') | Q(state='Sent')) label: Active Quotes icon: FileText color: blueKey points:
- Use
inherited_view: home_dashboard_viewto extend the Standard dashboard - Target existing anchors (e.g.,
dashboard_core_kpis) withposition: after - Always add an
anchorto your new rows so other modules can extend after them - Use security
groupson widgets for access control
Widget Types
Section titled “Widget Types”KPICard
Section titled “KPICard”Displays a single aggregated metric with icon, label, and formatted value. When the value
changes (a refresh, or a different filter), its digits roll to the new figure. Values of a
thousand and more are shortened to one decimal (12.5K, 3.2M).
widget: KPICardproperties: model: SaleOrder mode: count # count, sum, average, min, max measure: total # Required when mode != count filter: (Q(state='Confirmed')) label: Sales Orders icon: ShoppingCart # Lucide icon name color: blue # Mantine color format: number # number, currency, percent action: sale_order_action # Navigate to this action on click| Property | Type | Default | Description |
|---|---|---|---|
model | String | Required | Model to query |
mode | String | "count" | Aggregation: count, sum, average, min, max |
measure | String | - | Field to aggregate (required when mode is not count) |
filter | String | - | Q-expression filter |
label | String | "Count" | Display label |
icon | String | "ChartBar" | Lucide icon name |
color | String | "blue" | Mantine color |
format | String | "number" | number, currency, percent |
action | String | - | Action identifier to navigate to on click. The KPI’s filter is passed as global_filter. |
Default size: 3×3 grid units
Displays grouped data as a bar, area, line, donut or radar chart, or as a ranking.
widget: Chartproperties: title: Monthly Revenue model: SaleOrder chartType: bar # bar, area, line, donut, radar, ranking groupBy: field: date interval: month # day, week, month, quarter, year (for Date/Datetime fields) mode: sum measure: total # Required when mode != count filter: (Q(state__in=['Confirmed','Done']))| Property | Type | Default | Description |
|---|---|---|---|
model | String | Required | Model to query |
chartType | String | "bar" | bar, area, line, donut, radar, ranking |
groupBy | Object | Required | { field: "field_name", interval: "month" }. The interval key is optional and applies to Date/Datetime fields. Supported: day, week, month, quarter, year. |
mode | String | "count" | Aggregation: count, sum, average, min, max |
measure | String | - | Field to aggregate (required when mode is not count) |
filter | String | - | Q-expression filter |
title | String | - | Chart title |
format | String | - | currency or number, for the values in tooltips and on a ranking |
target | Number | - | bar, line and area only. Draws a dashed Target line at this value. |
targetSetting | String | - | bar, line and area only. The name of a setting (a field on Configuration) whose value is the target, read for the user’s current company each time the dashboard opens. Blank or zero draws no line. Use it instead of target whenever the number belongs to the business rather than to the module. |
bands | List | - | bar, line and area only. Shaded value ranges, each {from, to, label, color} (label and color optional; color is a Mantine color, default gray). |
limit | Integer | 10 | ranking only. How many groups are listed. |
Default size: 6×7 grid units (minimum height: 7)
Targets and bands
Section titled “Targets and bands”A target or band above every value is still drawn: the value axis stretches to include it.
widget: Chartproperties: title: Monthly Revenue model: SaleOrder chartType: line groupBy: {field: date, interval: month} mode: sum measure: total format: currency target: 50000 bands: - {from: 0, to: 30000, label: Behind, color: red} - {from: 30000, to: 50000, label: On track, color: green}A target is usually the customer’s own number, so a module ships the setting and points the widget at it. Sales’ Monthly Revenue chart does this with its Monthly Sales Target setting:
# models: a company-scoped setting, blank meaning "no target"sale_monthly_target = Float(nullable=True, description="Monthly Sales Target", company_scoped=True, groups=["sales_manager_group"])# the widget names the setting; there is no line until someone fills it inproperties: title: Monthly Revenue chartType: bar targetSetting: sale_monthly_targetSaving the view refuses a targetSetting that is not a setting (a field on
Configuration from your module or one it depends on), so a typo fails at install, at
upgrade and in check --only views rather than on a user’s screen. A widget that sets both
target and targetSetting is refused the same way.
Ranking
Section titled “Ranking”ranking lists one row per group, largest first: its name and value, with a bar underneath
scaled to the largest. Use it for “top customers” or “top products”, where a column chart’s labels would
collide. Only the largest limit groups are listed, and a line underneath counts the rest.
Long series
Section titled “Long series”A bar, line or area chart with more than 20 points along its axis gets a range selector underneath, so the user can zoom into part of the series. The Chart view does the same.
Checked when the view is saved
Section titled “Checked when the view is saved”A target or bands on a chart without a value axis (donut, radar, ranking), a band
without numeric from and to, a band key other than those four, and a limit on anything
but a ranking would all be ignored without a word, so saving the view refuses them.
Compact table widget for displaying records with formatted columns. Uses the same column spec format and formatting utilities as the CompactList form widget, but fetches its own data independently.
widget: Listproperties: title: Top Products model: Product limit: 5 order_by: total_sold DESC columns: - field: name label: Product bold: true - field: total_sold label: Sold format: integer align: right - field: list_price label: Price format: currency prefix: currency color: blue bold: true| Property | Type | Default | Description |
|---|---|---|---|
model | String | Required | Model to query |
title | String | - | Table title |
columns | Array | Required | Column definitions (see below) |
filter | String | - | Q-expression filter |
order_by | String/Array | - | Sort order (e.g., "total DESC") |
limit | Number | 5 | Max rows to display |
Column Properties:
| Property | Type | Default | Description |
|---|---|---|---|
field | String | Required | Field name to display |
label | String | Field name | Column header |
format | String | "text" | text, currency, number, integer, percent |
precision | Number | Format default | Decimal places |
align | String | Auto | left, center, right (numbers default to right) |
color | String | - | Mantine color for text |
bold | Boolean | false | Bold text |
prefix | String | - | Static string or field name from the item data |
suffix | String | - | Static string or field name from the item data |
Default size: 6×6 grid units (minimum height: 4)
Displays progress toward a target using a semi-circle progress indicator.
widget: Goalproperties: model: SaleOrder mode: count filter: (Q(state='Done')) target: 50 label: Monthly Sales Target color: green| Property | Type | Default | Description |
|---|---|---|---|
model | String | Required | Model to query |
mode | String | "count" | Aggregation: count, sum, average, min, max |
measure | String | - | Field to aggregate (required when mode is not count) |
filter | String | - | Q-expression filter |
target | Number | 100 | Goal target value |
label | String | "Goal" | Display label |
color | String | "blue" | Mantine color for filled segment |
format | String | "number" | number, currency, percent |
precision | Number | 0 | Decimal places |
Default size: 3×6 grid units (minimum height: 5)
Hierarchy
Section titled “Hierarchy”Breaks a value down along a tree — sales by product category, headcount by department, stock
by location — as a treemap (area is the share) or a sunburst (one ring per level). groupBy
names a relation to a tree model (one that declares _parent_field); totals roll up the
parent chain, so a category includes every subcategory beneath it. Each top-level branch
gets its own colour, and its children inherit it.
widget: Hierarchyproperties: title: Sales by Category model: SaleOrderLine groupBy: {field: product_category} mode: sum measure: subtotal hierarchyStyle: treemap # treemap or sunburst| Property | Type | Default | Description |
|---|---|---|---|
model | String | Required | Model to query |
groupBy | Object | Required | { field: "<relation to a tree model>" } |
mode | String | "count" | Aggregation: count, sum, average, min, max |
measure | String | - | Field to aggregate (required when mode is not count) |
filter | String | - | Q-expression filter |
hierarchyStyle | String | "treemap" | treemap or sunburst |
format | String | "number" | number, currency, percent |
Greeting
Section titled “Greeting”Built-in welcome widget with date display. Typically spans the full width.
widget: Greetingproperties: title: Welcome showDate: true showIcon: trueDashboardPreference Model
Section titled “DashboardPreference Model”Personal dashboards are stored in the DashboardPreference model:
| Field | Type | Description |
|---|---|---|
user | ManyToOne(User) | Owner (auto-set to current user) |
dashboard_id | Char | Dashboard identifier (links to the view) |
name | Char | Display name (e.g., “My Sales Dashboard”) |
sequence | Integer | Sort order in dropdown |
layout | JSON | Widget positions for react-grid-layout |
widgets | JSON | Widget configurations (type, properties) |
A RecordRule ensures users can only access their own dashboard preferences.
Next Steps
Section titled “Next Steps”- Widgets - Form field widget reference
- View Inheritance - Extending views across modules
- Stats Banner - Stats display for list/kanban views