Skip to main content
iVentureTeam

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.

Odoo 19 sale order form showing smart buttons at the top with statinfo numbers: 2 Delivery, 1 Invoices, and a purchase total.
Odoo 19 sale order form showing smart buttons at the top with statinfo numbers: 2 Delivery, 1 Invoices, and a purchase total.

Quick summary

  • statinfo renders the value-plus-label block inside a smart button at the top of a form, such as 3 Invoices.
  • It accepts six field types: float, integer, monetary, char, one2many and many2one, making it the most type-flexible display widget in core.
  • The label comes from the field's string by default; the label_field option swaps in a dynamic label from a char field on the record.
  • Decimals are controlled by digits, which the source accepts both as an option and as an attribute.
  • In Odoo Studio, smart buttons created with the Add Smart Button feature use this widget automatically; you never type its name.
  • It is used 197 times across 78 core modules, from stock to point_of_sale.
  • Odoo 20's development branch adds a hide_trailing_zeros option to it.
Studio name(used automatically by Studio smart buttons)
Technical namestatinfo
Field typesfloat, integer, monetary, char, one2many, many2one
Viewsform (inside stat buttons)
Moduleweb, present in every Odoo database
Used in core197 occurrences across 78 modules, including point_of_sale, stock, fleet, sale, mass_mailing, project
VersionsOdoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0
No-code setupYes, indirectly: Studio's Add Smart Button uses it for you
Alternativesmonetary, percentpie, gauge

What the Stat Info widget does

Every Odoo form with smart buttons across the top, the row of boxes showing things like 2 Delivery or 1 Invoices, is using statinfo. The widget renders a field's value in large type with a small label underneath, inside a <button> element that navigates somewhere when clicked.

Two things make it unusual among display widgets. First, its type list: it accepts float, integer, monetary, char, one2many and many2one, so the same widget shows a count, an amount, or a name. Second, it never renders alone. It only makes sense inside a button in a form view's button box, and the value it shows is almost always a computed count field on the model, such as invoice_count.

Worth knowing: the widget formats its value with the standard formatter for the field's type. A one2many shows its record count, a monetary formats with the currency, a char prints as-is. That is read straight from the source, which picks the formatter from the registry by field type.

What this means for your team

Smart buttons are the navigation your team actually uses. Nobody browses from a customer to their invoices through the menu; they click the Invoices button on the customer form. Every one of those buttons is a statinfo widget over a computed count.

That makes this widget the cheapest UX win in most Odoo customizations. When your operations lead asks "can I see how many open tickets this customer has without leaving the form", the answer is a computed field plus a statinfo button, a one-hour change that saves a lookup dozens of times a day. The pattern scales: counts of deliveries, running totals of purchases, hours logged, anything the model can compute can sit in the button box.

The discipline that matters is restraint. Forms with ten smart buttons stop being navigation and start being noise. Our rule on implementations is to show the three or four numbers a user of that form checks daily, and move the rest to list views and dashboards.

Setting it up in Odoo Studio (no code)

Studio never asks you to pick statinfo by name. It applies it automatically when you create a smart button.

  1. Open the form in Studio.

  2. Click the + in the button box (top-right area of the form) or choose Add Smart Button.

  3. Pick the related model and the action the button should open, for example the list of this customer's projects.

  4. Studio creates the computed count field on the model and the button XML around it, with statinfo as the display widget.

What Studio cannot do here

Studio builds the standard case: a count of related records opening a filtered list. Three common variations need XML.

A dynamic label, such as showing the related partner's name under the number, needs the label_field option.

Controlling decimals on a float or monetary stat, for example forcing one decimal on a hours total, needs the digits option or attribute.

A second value in the same button, the pattern account uses to show amounts alongside counts, is hand-written XML with multiple fields inside one button.

Supported options in Odoo 19

Verified against stat_info_field.js in the Odoo 19.0 web module. The digits entry is read from extractProps, where the source itself notes it is accepted "as an option and an attr"; it appears in no options panel.

OptionTypeWhat it does
label_fieldfield nameA char field on the current record whose value replaces the static label under the number. Lets the label change per record.
digitsarray [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

The standard smart button

<button name="action_view_invoices" type="object" class="oe_stat_button" icon="fa-file-text-o">
    <field name="invoice_count" widget="statinfo" string="Invoices"/>
</button>

The model side is a computed integer:

invoice_count = fields.Integer(compute="_compute_invoice_count")

def _compute_invoice_count(self):
    for rec in self:
        rec.invoice_count = len(rec.invoice_ids)

Dynamic label from another field

<field name="total_hours" widget="statinfo"
       options="{'label_field': 'stage_label'}"/>

The label under the number now comes from the stage_label char field on the record, so it can change with the record's state.

Controlling decimals

<field name="hours_spent" widget="statinfo" digits="[16, 1]"/>

One decimal place on the stat. The same value can be passed as options="{'digits': [16, 1]}"; both routes reach the formatter.

Number only, no label

<field name="ticket_count" widget="statinfo" nolabel="1"/>

What statinfo does not do

The widget itself does not make the button clickable, count anything, or open anything. Those three jobs belong to three other pieces, and confusing them is the root of most statinfo questions.

The count is the model's job. statinfo displays whatever value the field holds. A wrong count is a bug in the compute method, not in the widget.

The click is the button's job. The surrounding <button> element's name and type decide what opens. A common mistake is putting the field outside a button and wondering why nothing is clickable.

The look is the class's job. The oe_stat_button class on the button gives the box styling; without it you get a bare number floating in the form.

One more source-level detail: isEmpty is hardcoded to false, which means statinfo always renders even when the value is zero. A smart button showing 0 Claims is intentional Odoo behavior; hiding zero-count buttons needs an invisible condition on the button element.

Version compatibility

VersionStatusNotes
Odoo 20.0In developmentNot released. Adds hide_trailing_zeros in the development branch; see below.
Odoo 19.0VerifiedVerified against the shipped source and tested on a clean database.
Odoo 18.0VerifiedSame options and behavior. No XML changes needed.
Odoo 17.0VerifiedSame options and behavior. No XML changes needed.
Odoo 16.0VerifiedSame 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

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. The changes below are read from the public development branch and are not final until release.

One new option appears: hide_trailing_zeros, a boolean that trims zeros to the right of the last significant decimal, so 1.20 renders as 1.2. It matches the option of the same name on the monetary widget, bringing the two formatters in line.

No options are removed and the registration name is unchanged, so existing views should carry over untouched. We re-verify this page against the shipped release before updating the option table.

Common problems and fixes

SymptomCause and fix
The number shows but clicking does nothingThe 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 hiddenstatinfo 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 wrongThe 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 nameNo string attribute on the field element and no model-level label. Set string="..." on the field inside the button.
Monetary stat shows no currency symbolThe 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

WidgetBest forKey difference
statinfoNumbers inside smart buttons at the top of a formFormats value plus label inside a navigation button; type-flexible across six field types
monetaryAmounts in the body of the formCurrency-aware editing and display, not tied to a button
percentpieA percentage stat with a visual gaugeRenders a small pie chart instead of a plain number
gaugeProgress toward a target on kanban cardsGraphical gauge with a max value, kanban-oriented

The practical test: if the number belongs at the top of the form and should navigate somewhere on click, it is a statinfo smart button. If it belongs in the body of the form as data, use the plain field or monetary.

Frequently asked questions

How do I add a smart button with a count in Odoo?+
With Studio (Enterprise): open the form in Studio and use Add Smart Button, which creates the computed field and the button for you using statinfo. In code: add a computed integer field to the model, then a button with class oe_stat_button containing <field name="..." widget="statinfo"/>.
Can statinfo show money instead of a count?+
Yes. Its supported types include monetary and float. The value formats with the currency when the record's currency field is available in the view. The account module uses exactly this pattern for amounts in button boxes.
How do I hide a smart button when the count is zero?+
The widget always renders, by design. Put an invisible condition on the surrounding button element instead, such as invisible="invoice_count == 0".
Can the label under the number change dynamically?+
Yes, with options="{'label_field': 'some_char_field'}". The label is then read from that field on the current record instead of the static string.
Why is my statinfo count different from the list it opens?+
The count comes from your compute method and the list comes from the button's action domain. If they use different filters, the numbers diverge. Align the compute logic with the action's domain.
Does statinfo work in list or kanban views?+
It is registered without a view prefix, so nothing blocks it technically, but it is designed for the form view button box and its layout assumes it. In lists and kanbans use the plain field or a dedicated widget instead.

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

How this page was produced

The option table was read from the Odoo 19.0 web module source (stat_info_field.js), including the extractProps code path that accepts digits as either option or attribute, and confirmed on a clean Odoo 19 database, where the screenshot was captured. The Studio steps were performed on an Odoo 19 Enterprise database. The Odoo 20 section is read from the public development branch and marked as unreleased. Spotted an error or a version difference? Tell us and we will correct the page.

Get our monthly Odoo & automation digest

One short email per month with practical insights, version updates, and field-tested tips. No fluff, unsubscribe anytime.