statinfo
The number inside an Odoo smart button, such as 3 Invoices, is rendered by the statinfo widget. Here is how it works, what it can show, and how to control its label and decimals.
| Studio name | (used automatically by Studio smart buttons) |
|---|---|
| Technical name | statinfo |
| Field types | float, integer, monetary, char, one2many, many2one |
| Views | form (inside stat buttons) |
| Module | web, present in every Odoo database |
| Used in core | 197 occurrences across 78 modules, including point_of_sale, stock, fleet, sale, mass_mailing, project |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0 |
| No-code setup | Yes, indirectly: Studio's Add Smart Button uses it for you |
| Alternatives | monetary, percentpie, gauge |
What the Stat Info widget does
What this means for your team
Setting it up in Odoo Studio (no code)
What Studio cannot do here
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
label_field | field name | A char field on the current record whose value replaces the static label under the number. Lets the label change per record. |
digits | array [width, decimals] | Decimal precision for the formatted value, e.g. [16, 1]. Accepted both as an option and as a digits attribute on the field element; the attribute wins when both are set. |
The label logic has an order of precedence. If label_field is set, the label is that field's value on the current record. Otherwise it is the string attribute on the field element, falling back to the field's model-level label. Setting nolabel="1" on the field element hides the label entirely, leaving just the number.
Working examples
What statinfo does not do
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Adds hide_trailing_zeros in the development branch; see below. |
| Odoo 19.0 | Verified | Verified against the shipped source and tested on a clean database. |
| Odoo 18.0 | Verified | Same options and behavior. No XML changes needed. |
| Odoo 17.0 | Verified | Same options and behavior. No XML changes needed. |
| Odoo 16.0 | Verified | Same options and behavior. No XML changes needed. |
Upgrade note. The file moved from statinfo/statinfo_field.js in earlier versions to stat_info/stat_info_field.js; the registered widget name statinfo is unchanged, so XML is unaffected. Only JavaScript patches that import the file by path need updating.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| The number shows but clicking does nothing | The field sits outside a button element, or the button has no name/type action. Wrap the field in a button with class oe_stat_button and a valid action method. |
| Button shows 0 and you want it hidden | statinfo always renders; its isEmpty is hardcoded to false in the source. Add an invisible condition on the button element, e.g. invisible="invoice_count == 0". |
| The count is wrong | The computed field's logic, not the widget. statinfo displays whatever the field holds. Debug the compute method; check record rules are not filtering the related records. |
| Label shows the technical field name | No string attribute on the field element and no model-level label. Set string="..." on the field inside the button. |
| Monetary stat shows no currency symbol | The monetary formatter needs the currency field on the record and it is missing from the view. Add the currency field to the view (it can be invisible). |
Stat Info widget vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
statinfo | Numbers inside smart buttons at the top of a form | Formats value plus label inside a navigation button; type-flexible across six field types |
| monetary | Amounts in the body of the form | Currency-aware editing and display, not tied to a button |
percentpie | A percentage stat with a visual gauge | Renders a small pie chart instead of a plain number |
gauge | Progress toward a target on kanban cards | Graphical gauge with a max value, kanban-oriented |
Frequently asked questions
How do I add a smart button with a count in Odoo?+
Can statinfo show money instead of a count?+
How do I hide a smart button when the count is zero?+
Can the label under the number change dynamically?+
Why is my statinfo count different from the list it opens?+
Does statinfo work in list or kanban views?+
Want the right numbers at the top of every form?
Smart buttons with accurate live counts, amounts and hours are one of the highest-value small customizations in Odoo. We add the computed fields, the buttons, and the filtered actions behind them, across Odoo 16 to 19.
Book a free consultation