time_period_selection
A selection whose labels are written when the page loads. Instead of "last year, month plus one" it says "February 2025", which is the difference between a setting people use and one they avoid.
| Technical name | time_period_selection |
|---|---|
| Field types | selection |
| Views | form |
| Module | purchase_stock, the bridge between Purchase and Inventory |
| Used in core | 1 occurrence, the replenishment information dialog in stock |
| Versions | Odoo 20.0, Odoo 19.0 |
| No-code setup | No. The selection values it rewrites are specific to the replenishment model |
| Alternatives | selection, filterable_selection, dynamic_selection, date |
What the time period selector does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
placeholder_field | field | Inherited from the selection widget. Shows another field's value as a hint when this one is empty. |
onChange | prop, not an option | Declared and called after the standard change handling, but never extracted from the view, so it can only be supplied by a parent component rendering the field directly.(since Odoo 19.0) |
The four rewritten values are hardcoded. The widget matches them by key and produces the corresponding label; any other value is passed through unchanged, and any entry whose key is false or whose label is empty is removed. It also declares an onChange prop, but nothing in the descriptor extracts one, so that hook can only be reached by a parent component passing it directly.
Working examples
Labels computed from today, and a dead callback
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Behavior identical on the development branch; the unused callback prop is redeclared in the new syntax. |
| Odoo 19.0 | Verified | First version. Verified against the shipped source. |
| Odoo 18.0 | Not available | Widget does not exist. The selector showed its stored labels. |
| 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 period selector showed its stored labels, so an upgrade improves the dialog with the standard views and nothing needs migrating.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| The labels are still the technical ones | The field is not using this widget, or its selection keys are not the four the widget recognizes. Check the widget attribute and the model's selection keys. |
| The months look wrong | They are computed from today's date, one year back, so they shift as the months pass. Expected. Reload the page if it has been open across a month boundary. |
| Some options are missing | Entries with a false key or an empty label are filtered out. Expected. Give the value a real label if it should be selectable. |
| The onChange hook never fires my code | The prop is declared but never extracted from the view. Render the field from a parent component that passes the callback, or patch the descriptor. |
| Missing widget error | The bridge module between Purchase and Inventory is not installed. Install both Purchase and Inventory so the bridge module is present. |
| Tooling shows a misspelled widget name | The declared display name contains a typo in the source. Nothing to fix; the registered name itself is correct. |
Time period selector vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
time_period_selection | Selections whose labels only make sense as dates computed from today | Rewrites four known keys into real month and quarter names and drops empty entries |
| selection | Any selection whose stored labels are already meaningful | No rewriting and no filtering |
| filterable_selection | Long selections the user should narrow | Interactive filtering rather than computed labels |
| dynamic_selection | Values sourced from the server | The server decides the list; here only the labels are computed |
| date | Picking an actual date | A calendar rather than a fixed set of relative periods |
Frequently asked questions
Where do the month names come from?+
Which values does it rewrite?+
Why did some options disappear?+
What is the onChange prop for?+
Which module provides it?+
Forecasts based on the right stretch of history
Which past period predicts your demand is a business question before it is a setting, and the answer differs by product line. We tune Odoo replenishment and demand estimation on versions 16 through 19.
Book a free consultation