counted_quantity_widget
The counted quantity cell in a physical inventory. The hard part is not the number, it is knowing the difference between counted zero and not counted at all.
| Technical name | counted_quantity_widget |
|---|---|
| Field types | float |
| Views | list, form |
| Module | stock, the Inventory app |
| Used in core | 1 occurrence, the counted quantity on the physical inventory list in stock |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0 |
| No-code setup | No. It writes a companion flag that has to exist on the model |
| Alternatives | float, integer, qty_at_date_widget, forecast_widget |
What the counted quantity field does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
inventory_quantity_set | companion field | Written by literal name alongside every committed value, and read to decide whether a read-only cell renders blank. Without it, counted zero and uncounted look identical. |
digits | list | Inherited from the decimal field. Controls the displayed precision. |
enable_formatting | boolean | Inherited. Set to false to remove locale formatting from the displayed value.(default: true) |
type | string | Inherited. Set to number to render a real HTML number input. |
It writes a second field by literal name. Every commit updates the counted quantity and the companion counted flag in the same operation, and the blank display also reads that flag. A model without it will still render, but the counted and uncounted states become indistinguishable.
Working examples
Three listeners and one local flag
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Same rules on the development branch; listener and state helpers modernized. |
| Odoo 19.0 | Verified | Verified against the shipped source. The counted flag is written only when a value is committed. |
| Odoo 18.0 | Partial / changed | Same purpose, but the counted flag was written on the first keystroke, so touching a cell marked the line as counted. |
| Odoo 17.0 | Partial / changed | As Odoo 18. |
| Odoo 16.0 | Partial / changed | As Odoo 18. |
Upgrade note. No view change is needed, but the behavior differs. On Odoo 18 and earlier, touching a counted quantity cell marked the quant as counted immediately; from Odoo 19 the flag is written only when a value is committed. If your count procedures were written around the older behavior, they can be simplified.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Uncounted lines show zero instead of blank | The model does not carry the companion counted flag, or the cell is editable rather than read-only. Add the flag field; the blank display applies to read-only cells only. |
| A line was marked as counted without being counted | On Odoo 18 and earlier, typing anything set the flag immediately. Upgrade to Odoo 19, where the flag follows a committed value. |
| A typed value is not saved | It was not committed: the cell was left without blurring or pressing Enter or Tab. Press Enter or Tab, or click elsewhere in the list. |
| An invalid entry is silently ignored | The commit wraps the parse and lets the normal validation path report the problem. Correct the entry; the error surfaces through standard validation. |
| Keyboard counting does not advance | Something is intercepting Enter or Tab before the widget's handler. Check for a competing keyboard handler in a customization. |
| The flag is set but the quantity is empty | A counted zero, which is exactly what the flag exists to record. Nothing to fix; that is the case the widget was built for. |
Counted quantity field vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
counted_quantity_widget | Physical inventory counts, where zero and not yet counted must differ | Writes a counted flag only on a committed value, and renders uncounted lines blank |
| float | Ordinary decimal quantities | No counted flag and no blank display for unset values |
integer | Whole number quantities | Different type, same lack of counted semantics |
qty_at_date_widget | Forecast availability on a line | Shows projected stock rather than recording a count |
| forecast_widget | Whether a demand will be fulfilled | A verdict badge rather than an editable quantity |
Frequently asked questions
Why does an uncounted line show blank rather than zero?+
When is the counted flag written?+
What changed in Odoo 19?+
Why does it install its own listeners?+
Does it support the decimal field's options?+
Stock counts you can act on without second-guessing
Cycle counts, adjustment approvals and the valuation entries behind them only work if the data says what actually happened. We set up Odoo Inventory counting procedures on versions 16 through 19.
Book a free consultation