Skip to content
ERPForAll DocsDevelopment

    Dashboard cards

    A dashboard card is a kanban card that shows, for one record, buttons that start work, figures that open the records behind them, and a small bar or line chart. The Accounting overview (one card per journal) and the Inventory overview (one card per operation type) are built this way.

    Kanban cards admit only field nodes, so the whole card is one field with a widget:

    <record id="journal_dashboard_kanban" model="ir.ui.view">
    <field name="name">account.journal.dashboard.kanban</field>
    <field name="model">account.journal</field>
    <field name="arch" type="xml">
    <kanban string="Accounting" can_open="0">
    <templates>
    <t t-name="card">
    <field name="name"/>
    <field name="dashboard_card" widget="dashboard_card"/>
    </t>
    </templates>
    </kanban>
    </field>
    </record>

    The first field is the card’s title, as on every kanban card. widget="dashboard_card" is admitted on text fields only; on any other type, installation fails with Field widget 'dashboard_card' does not support type '<type>'.

    The model declares dashboard_card as a computed text field that is not stored:

    #[field(text, compute = "_compute_dashboard_card")]
    pub dashboard_card: String,

    Compute it in one batch for all the records requested, under the caller’s access rights and company scope. Write the JSON text described below, or leave the value empty for a record that has nothing to show. Labels are already translated for the user, and domains hold concrete values; the client evaluates nothing in them.

    {"v": 1,
    "buttons": [{"label": "New Invoice",
    "action": "account.action_move_out_invoice_type",
    "view_mode": "form",
    "context": {"default_move_type": "out_invoice", "default_journal_id": 5},
    "primary": true}],
    "stats": [{"label": "Late", "count": 3,
    "amount": "1250000.00", "currency_id": 12,
    "action": "account.action_move_out_documents",
    "domain": [["journal_id", "=", 5], ["state", "=", "posted"]],
    "context": {"default_journal_id": 5}, "tone": "danger"}],
    "chart": {"type": "bar", "label": "Due",
    "points": [{"label": "Overdue", "value": "900000.00", "tone": "danger"}]}}
    KeyValue
    v1
    buttons[]label (text), action (XML id module.name of an ir.actions.act_window), view_mode ("form" opens a new record, "list" the action’s list, null the action’s own list), context (object), primary (boolean)
    stats[]label, count (whole number, zero or more), amount (decimal text) and currency_id (currency id), both null for a plain count, action, domain (list of [field, operator, value] conditions and &, |, !), context, tone
    chartnull, or type ("bar" or "line"), label, points[] of label, value (decimal text) and tone
    tone"neutral", "warning" or "danger"

    A context (of a button or a figure) is an object of at most 16 keys. Each key is default_<field> (lower-case letters, digits and underscores), and each value is a text, a boolean or a whole number. Any other key or value form (a list, an object, a decimal number, null) is refused and the card shows which key. A search_default_<name> key is refused by name too: the list a card opens does not apply default filters yet, so the list would show every row next to a figure that counts only some. Put the condition in the figure’s domain instead. A card never replaces a session key: allowed_company_ids, lang, tz and the like are refused in a card’s context, and the session’s own values always win when the action opens.

    Every key is required, including those whose value is null. Amounts and chart values are decimal texts ("1250.00", "-20"), never JSON numbers, so no amount is rounded on the way.

    • The buttons come first, the primary ones before the others, in the order sent. A button opens its action with its context: view_mode: "form" opens a new record whose defaults come from the context (default_* keys).
    • Each figure is one button: the count, the label and, when there is an amount, the amount formatted in its currency (symbol, position and decimals of currency_id, read once per view). The tone colours the count. Activating it opens the action’s list, filtered by the action’s own domain and the figure’s domain, with the figure’s context. A control activated again before its list opened still opens it once, and an action that answers after the user went to another page opens nothing.
    • The chart draws a bar per point (coloured by its tone) or one line through the points, over a zero line, at a fixed height (--dashboard-chart-height). Under it at most six point labels are shown, every n-th counted from the last point, each under its own point; a label in ISO form reads as a short date (2026-11-17 as “17 Nov”, 2026-11 as “Nov 26”). Screen readers read every point with its full label as a list (“Overdue: 900,000 (danger)”).
    • Every button and figure is a native button: Tab reaches it, Enter or Space activates it, and activating it never also opens the card’s record. The card’s own Enter and arrow keys keep working on the card itself.
    • A board of dashboard cards uses wider columns (at least 360 pixels, or the full width on a phone).
    • The way back from an opened list or form is the breadcrumb to the overview.

    An action opens as its list (and its form); an action without a list view is refused with a message that names it. Other first views (a kanban, a pivot) come with the action result that can carry them.

    The client resolves an action XML id with ir.actions.act_window.erp_load_web_action_ref, a Read method on the model (no record ids). Pass xml_id (module.name) with the caller context; it returns the same window action as erp_load_web_action, after the same checks (action access, its groups, read access to its model). An unknown XML id, an XML id of a record that is not a window action, and an action the caller may not read all answer You may not read this window action., so the method reveals nothing about which XML ids exist. A malformed xml_id (no module part, more than one dot, whitespace, longer than 256 bytes) is refused with a validation error that says what is wrong. The widget calls nothing else of its own: the currency read is the ordinary res.currency web_read the monetary widget uses, and the opened list or form reads its records as usual.

    A value that departs from the contract is not drawn in part. The card shows one line in the danger colour that names the key, for example:

    ValueShown on the card
    "v": 2, or no vDashboard card: v 2 is not a known version (expected 1).
    a key left outDashboard card: stats[0].tone is missing.
    a key the contract does not haveDashboard card: card.title is not part of contract v1.
    a wrong typeDashboard card: stats[0].count must be a whole number of zero or more.
    an unknown toneDashboard card: stats[0].tone must be neutral, warning or danger.
    an unknown chart typeDashboard card: chart.type must be "bar" or "line".
    a number or 1e5 as an amount or a chart valueDashboard card: stats[0].amount must be a decimal text such as "1250.00".
    an amount without a currency, or the reverseDashboard card: stats[0].currency_id must be null exactly when amount is null.
    an action that is not module.nameDashboard card: buttons[0].action must be a window action XML id (module.name).
    text that is not JSONDashboard card: the value is not valid JSON.

    An empty value (false, null or an empty text) is a record without dashboard data: the card shows its title only. Used in a form or a list, the widget shows The dashboard card widget is drawn on kanban cards only. A card holds at most 64 buttons, figures or chart points, labels of at most 256 characters, and a value of at most 65,536 characters; past that the card shows which list or label is too long.

    The reference builds these cards from free kanban template markup plus a chart field that parses its JSON text without a check and draws on a bare canvas. Here the card is one declared field with a closed contract: a wrong value is named on the card instead of breaking it, amounts travel as exact decimal text, the chart has a text alternative, and every figure is a keyboard-reachable button with a full accessible name.

    Wide cards place actions beside their figures. Narrow cards stack them. A zero chart value stays on the baseline.