stock_action_field
A quantity or an amount that is also a link. Click the On Hand figure on a product list and it opens the stock view for that product, with context.
| Technical name | stock_action_field |
|---|---|
| Field types | float, monetary |
| Views | list, form |
| Module | stock, the Inventory app |
| Used in core | 1 occurrence, the On Hand column on the product list in stock |
| Versions | Odoo 20.0, Odoo 19.0 |
| No-code setup | No. It needs an action name and usually a context expression |
| Alternatives | float, monetary, statinfo, qty_at_date_widget |
What the clickable amount does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
action_name | string | The external identifier of the action opened on click. The only option the widget declares.(since Odoo 19.0) |
disabled | string (expression) | <strong>Read in the extractor but never declared.</strong> A Python expression evaluated against the record; when it is true the value is rendered without the click.(since Odoo 19.0) |
context | string (field attribute) | <strong>Read in the extractor but never declared.</strong> The field's own context attribute, evaluated against the record and merged into the action's context.(since Odoo 19.0) |
digits | list | Inherited, and applied when the field is a decimal. Controls displayed precision. |
currency_field | field | Inherited, and applied when the field is a currency amount. Names the currency field to format against. |
The declared option list is malformed. It is built by pushing the merged decimal and currency options into the array as a single nested array, rather than spreading them, so anything reading the declarations finds an array where an option object is expected. Rendering is unaffected, because the extractor reads the options dictionary directly, but developer tooling will not present the inherited options usefully.
Working examples
One widget, two renderers, three undeclared knobs
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Behavior identical on the development branch. |
| Odoo 19.0 | Verified | First version. Verified against the shipped source. |
| Odoo 18.0 | Not available | Widget does not exist. The On Hand column was a plain quantity. |
| Odoo 17.0 | Not available | Widget does not exist. |
| Odoo 16.0 | Not available | Widget does not exist. |
Upgrade note. The widget is new in Odoo 19. On Odoo 18 and earlier the On Hand column was a plain quantity, so an upgrade makes the figure clickable with the standard product views and there is nothing to migrate.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Clicking does nothing | The action name option is missing, or the disabled expression evaluates to true for that record. Set action_name, and check the disabled expression against the record's data. |
| The target opens unfiltered | The field has no context attribute, so no additional context reaches the action. Add a context expression referencing the record, as the core view does. |
| The number is not formatted | The field is neither a decimal nor a currency amount, so only the action props are extracted. Use it on a float or monetary field, or format the value another way. |
| Unsaved changes are lost on click | The click opens an action without saving first. Use the widget on lists rather than on forms with pending edits. |
| Developer tooling shows no inherited options | The declared option list nests the inherited options inside an array element instead of spreading them. Consult this page or the source; rendering itself is unaffected. |
| The disabled option is ignored | It is read from the options dictionary as an expression string; a boolean will not evaluate as intended. Pass a quoted expression, not a Python boolean. |
Clickable amount vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
stock_action_field | Quantities and amounts in a list that should lead to a filtered view | Chooses its renderer from the field type and opens a named action with record-derived context |
| float | A plain decimal value | No click and no action |
| monetary | A plain currency amount | Currency formatting without navigation |
| statinfo | A figure in a stat button | The button carries the action, not the field |
qty_at_date_widget | Forecast availability | Explains a quantity rather than linking from it |
Frequently asked questions
How does the widget know whether to format as a quantity or an amount?+
How do I filter the target view?+
Can I disable the link for some records?+
Why does developer tooling show odd options?+
Does clicking save the record first?+
Numbers that answer the next question too
Clickable figures, filtered destinations and the reports behind them turn a list into a tool. We build that kind of navigation into Odoo on versions 16 through 19, without turning every column into a link.
Book a free consultation