Skip to content

[18.0][web_widget_dropdown_dynamic][FIX]: value dissappearing afetr losing …#3496

Open
Rad0van wants to merge 1 commit intoOCA:18.0from
Rad0van:18.0
Open

[18.0][web_widget_dropdown_dynamic][FIX]: value dissappearing afetr losing …#3496
Rad0van wants to merge 1 commit intoOCA:18.0from
Rad0van:18.0

Conversation

@Rad0van
Copy link
Copy Markdown

@Rad0van Rad0van commented Mar 29, 2026

…focus when used in list view

I was using a list view of one2many inside a form with selection field using web_widget_dropdown_dynamic widget noticing strange behavior: selecting an option works fine but when the field loses focus, the value dissappears. However it is saved into the database. When loading the form the value is not there either, onl;y when clicking the field.

The web.SelectionField template has two rendering paths:

  • Edit mode: uses options + value → <select> renders correctly with the chosen option
  • Readonly mode: uses this.string → <span t-esc="string">

FieldDynamicDropdown extends Component directly (not SelectionField), so get string() was never inherited. When an editable list row loses focus and switches back to readonly display, this.string is undefined — OWL renders an empty span. The value is still in the record (hence "saved into database later"), but the readonly display renders blank.

Fix: Added get string() to FieldDynamicDropdown that looks up the label for the current value from this.specialData, matching the same logic as SelectionField.string but working with the dynamically-fetched options. With the help of Claude added a test for this as well.

@pedrobaeza pedrobaeza added this to the 18.0 milestone Mar 30, 2026
@pedrobaeza pedrobaeza changed the title [web_widget_dropdown_dynamic][FIX]: value dissappearing afetr losing … [18.0][web_widget_dropdown_dynamic][FIX]: value dissappearing afetr losing … Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants