OdooWiki OCA HUB

Dynamic Dropdown Widget

web_widget_dropdown_dynamic folder_open OCA/web open_in_new
Web License: LGPL-3

Dynamic dropdown widget that supports resolving options from backend of:

> - fields.Char > - fields.Integer > - fields.Selection

NOTE: This widget is not intended to extend fields.Selection, but to filter selection values. For fully-dynamic set of options, use fields.Char instead.

auto_awesome What this module does

AI-generated from the code · Odoo 19.0

Adds a new "Dynamic Dropdown" field widget for Odoo forms. It lets developers show a dropdown whose options are fetched from the server, optionally depending on another field on the same form.

This module is a technical building block for Odoo developers rather than a ready-made business feature. It registers a new field widget called "Dynamic Dropdown" that can be used on char, integer and selection fields.

When a form is opened, the widget calls a method on the record's model to get the list of available options, and shows them in a dropdown. The method name is configured in the field's options, and extra context can be passed, for example the value of another field on the form. If that other field changes, the options are fetched again.

Business rules added by the widget: - If the current value is no longer among the options returned by the server, the field is automatically cleared. - For integer fields, a non-numeric or zero selection is rejected as invalid. - Empty selections are stored as no value.

To demonstrate how it works, the module ships a demo setup on the ir.filters model: a manual integer field named "Dropdown Integer" is added to the filter form, and a demo method returns a small list of options, adding one extra option when the administrator is among the selected users. This demo is only installed with demo data and is meant as an example, not as a business feature.

Text generated by AI (DeepSeek) from reading the Odoo 19.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 8 confirmed, 1 with no information of 9 versions.

terminal Installation and usage

OCA documentation · Odoo 19.0
@api.model
def method_name(self):
    values = [
        ('value_a', 'Title A'),
    ]
    if self.env.context.get('depending_on') == True:
        values += [
            ('value_b', 'Title B'),
        ]
    return values
<field
    name="other_field"
/>
<field
    name="char_field"
    widget="dynamic_dropdown"
    options="{'values':'method_name'}"
    context="{'depending_on': other_field}"
/>

DEMO

On User defined filters added new field to show the feature, it is called Dropdown Integer. If any user selected just One option shoud appear, but if Mitchell Admin it should be possible to select option One and Two.

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.