Skip to main content
iVentureTeam

dashboard_graph

The little line and bar charts on Odoo's accounting dashboard are a text field and a Chart.js canvas. One attribute decides which chart you get, and there is no third option.

Siddharth JambukiyaSiddharth JambukiyaOdoo Techno-Functional Consultant
August 27, 2026Updated August 27, 20267 min read
Technical namedashboard_graph
Field typestext
Viewskanban
Moduleweb, present in every Odoo database
Used in core1 occurrence in Odoo 19, the accounting journal dashboard kanban
VersionsOdoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0
No-code setupNo. The chart data has to be computed server side into a JSON text field
Alternativespicking_type_dashboard_graph, workcenter_dashboard_graph, gauge, percentpie

What the dashboard graph field does

Odoo's accounting dashboard shows one card per journal, and each card carries a small chart: a line for bank and cash balances over time, bars for the ageing of outstanding invoices. Those charts are not a graph view and not a report. They are a field.

The model computes a JSON string, stores it in a text field, and the kanban renders that field with this widget. The widget parses the string, hands it to Chart.js and draws a compact canvas with no axes, no legend and no interaction beyond a tooltip.

Which chart it draws comes from a graph_type attribute on the field element. The accounting dashboard sets it dynamically per card, so a bank journal gets a line and a sales journal gets bars, from the same field and the same widget.

What this means for your team

The pattern is worth knowing because it is the cheapest way to put a real chart on a kanban card. There is no dashboard framework involved: a computed field, a JSON structure and one attribute. For a client who wants a sparkline on each project, warehouse or team card, this is the shape of the answer, and Odoo core has three variants of it already.

The constraint that shapes the work is that the data is computed server side. Any filtering, date range or currency decision happens in Python, not in the widget, so the chart shows what the model decided to show. That is good for performance, because the payload is tiny and cached with the record, and limiting for interactivity, because the user cannot change the range without a new server computation.

The sample-data flag deserves a mention in any demo. When it is set the line chart is drawn in faded colors and tooltips are switched off, so a prospect looking at a fresh database sees that the curve is illustrative rather than their data. It is a small honesty feature that is easy to lose when you copy the widget into a custom module.

Supported options in Odoo 19

There are no options. The single knob is an attribute on the field element, and the widget declares one supported field type. Everything else is decided by the JSON the server produces. Read from journal_dashboard_graph_field.js, Odoo 19.0.

OptionTypeWhat it does
graph_typestring (attribute)Written on the field element, not in options. Accepts line or bar. Declared as a required string prop, and any other value leaves the chart without a configuration.
is_sample_datakey in the JSON payloadSet by the server. Fades the line chart's colors and disables tooltips on both chart types, so demo data reads as demo data.(default: false)
typekey on each bar data pointSet by the server. Colors the bar: one color for past, another for future, and a neutral grey for anything else.

Only two chart types exist. The render method builds a configuration for line and for bar and does nothing for any other value, so a typo leaves the chart constructor without a configuration rather than falling back to a default. The prop is also declared as a required string, so omitting the attribute entirely is a props error.

Working examples

The core usage

<field name="kanban_dashboard_graph"
       widget="dashboard_graph"
       t-att-graph_type="['cash', 'bank', 'credit'].includes(journal_type) ? 'line' : 'bar'"/>

The attribute is set with a QWeb expression, so each card picks its own chart type from the record's own data.

A fixed chart type

<field name="graph_data" widget="dashboard_graph"
       graph_type="line"/>

Simpler and just as valid when every card shows the same kind of chart.

The JSON the field has to contain

[{
  "key": "Balance",
  "is_sample_data": false,
  "values": [
    {"x": "01 Jan", "y": 1200, "label": "January",
     "value": 1200, "type": "past"}
  ]
}]

An array whose first element is used. Line charts read the x and y keys, bar charts read label, value and type.

Parsed once, and two different sample-data rules

Two details govern how this widget behaves in practice, and neither is documented.

The first is that the JSON is parsed once, in the component's setup, and stored on the instance. The redraw effect runs after every render, but it always redraws from that stored copy. So if the underlying field changes while the card is on screen, for example after a server-side recompute, the chart keeps drawing the old data until the component is recreated. On a dashboard that is reloaded wholesale this never shows; on a card that updates in place, it does.

The second is the sample-data handling, which differs by chart type. In a line chart, the flag fades both the border and the fill to a fraction of their opacity and disables tooltips. In a bar chart it only disables tooltips; the bars keep their normal colors. So a sample bar chart looks real, and a sample line chart does not.

The bar coloring is worth spelling out because it is the whole reason the bar variant exists. Each point carries a type, and the widget picks one color for past, another for future, and a neutral grey for anything else. On the accounting dashboard that is what separates overdue amounts from amounts not yet due, without a legend.

Both charts hide their y axis entirely and the line chart hides its x axis too, which is what makes them read as sparklines rather than as reports. The bar chart keeps an x axis with grid and label colors chosen for the active light or dark scheme.

Version compatibility

VersionStatusNotes
Odoo 20.0Partial / changedNot released. The widget remains, but accounting moves to its own copy and Point of Sale becomes the core user.
Odoo 19.0VerifiedVerified against the shipped source. Byte-identical to Odoo 18.
Odoo 18.0VerifiedSame contract. New color palette indices, tooltips disabled on sample data, dark-scheme aware axis colors.
Odoo 17.0VerifiedSame attribute and JSON contract, older palette and no sample-data tooltip handling.
Odoo 16.0VerifiedSame attribute and JSON contract. The colors helper lived elsewhere and Chart.js was loaded as a single script.

Upgrade note. The attribute and the JSON contract are unchanged from Odoo 16 through Odoo 19, so views and server-side computations carry over. What changed in Odoo 18 is entirely visual: the color palette indices were re-picked against the newer color helper, tooltips became disabled on sample data, and the bar chart's grid and label colors became aware of the dark scheme. Odoo 18 and Odoo 19 are byte-identical.

What is changing in Odoo 20

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. The development branch is unstable and this can still change; we re-verify the page after release.

The widget changes hands. Accounting stops using it: the development branch adds a dedicated accounting dashboard graph widget in the account module and the journal dashboard switches to it. The base widget stays in web, and on that branch its core user becomes the Point of Sale dashboard, with a fixed line chart type.

Internally it moves to a chart hook. The manual bundle loading, canvas reference and destroy effect are replaced by a shared hook that takes a configuration getter, and the props move to the new schema. The chart configurations themselves, the sample-data rules and the bar coloring are unchanged.

Common problems and fixes

SymptomCause and fix
The card shows an empty space where the chart should beThe graph_type attribute is missing or is neither line nor bar, so no chart configuration is built. Set graph_type="line" or graph_type="bar", or compute it with a t-att expression.
A JSON parse error in the consoleThe field does not contain valid JSON, most often because it is empty on a new record. Make the server-side compute return a valid array, using an empty values list when there is nothing to show.
The chart does not update after the data changesThe JSON is parsed once when the component starts and the redraw uses that copy. Reload the kanban so the cards are recreated.
Bars are all greyThe data points carry no type, or a type other than past or future. Set the type key on each point in the server-side computation.
Tooltips do not appearThe payload is flagged as sample data, which disables them on both chart types. Expected on a demo database. Clear the flag once real data exists.
The line chart looks washed outSample data fades the border and fill colors, on the line chart only. Expected. Bar charts keep their colors even when flagged.
Missing widget error after upgrading to Odoo 20Accounting views switch to a dedicated widget name on the development branch. The base widget still exists; check which name your inherited view is using.

Dashboard graph field vs the alternatives

WidgetBest forKey difference
dashboard_graphCompact charts on kanban cards, driven by a server-computed JSON fieldReads a JSON text field and draws a Chart.js sparkline with no axes and no interaction
picking_type_dashboard_graphThe same idea on inventory operation typesAdds a third color bucket for the present day and its own click targets
workcenter_dashboard_graphThe same idea on manufacturing work centersWork center specific data and click handling
gaugeA single value against a targetOne number rendered as an arc rather than a series
percentpieA proportion on a cardA single percentage, no time series

If you want a chart on a kanban card, this is the mechanism, and the two other core variants show how to extend it: the inventory one adds a third bucket for present, and the manufacturing one takes its chart type from an attribute in the same way. If you want an interactive chart with filters and drill-down, that is a graph view or a dashboard action, not a field widget.

Frequently asked questions

How do I choose between a line and a bar chart?+
With the graph_type attribute on the field element. It takes line or bar, and it is an attribute rather than an option, so it can be set with a QWeb expression per card.
What does the field have to contain?+
A JSON string holding an array. The widget uses the first element, which needs a key label and a values list. Line charts read x and y from each point; bar charts read label, value and type.
Why does the chart not refresh when the data changes?+
The JSON is parsed once when the component starts and the redraw reuses that parsed copy. Reloading the view recreates the component and picks up new data.
What is the sample data flag for?+
It marks demo data. On a line chart it fades the colors and disables tooltips; on a bar chart it only disables tooltips, so the bars still look normal.
Can I use it outside the accounting dashboard?+
Yes. It lives in the web module and works on any text field holding the right JSON. Two core variants, for inventory and manufacturing, are built the same way.

Want a dashboard your team opens every morning?

Kanban charts, computed KPIs and the server-side queries behind them are a small build with a long life, as long as the numbers are the ones your business actually steers by. We design and build those dashboards inside Odoo, on versions 16 through 19.

Book a free consultation

How this page was produced

The chart configurations, the required attribute, the two accepted types, the single parse in setup and the sample-data rules were read from journal_dashboard_graph_field.js on the Odoo 19.0 branch, with the usage taken from account/views/account_journal_dashboard_view.xml. The visual changes introduced in Odoo 18 come from comparing the same file across the 16.0, 17.0 and 18.0 branches. The change of core user in Odoo 20 was verified by locating the new accounting widget and the updated views on the public development branch. Spotted an error? Tell us and we will correct the page.