Skip to content

[18.0][web_widget_dropdown_dynamic][FIX]: propagate required prop and value dissappearing after losing focus when used in list view#3509

Open
Rad0van wants to merge 1 commit intoOCA:18.0from
Rad0van:fix-web_widget_dropdown_dynamic-propagate_required
Open

[18.0][web_widget_dropdown_dynamic][FIX]: propagate required prop and value dissappearing after losing focus when used in list view#3509
Rad0van wants to merge 1 commit intoOCA:18.0from
Rad0van:fix-web_widget_dropdown_dynamic-propagate_required

Conversation

@Rad0van
Copy link
Copy Markdown

@Rad0van Rad0van commented Apr 13, 2026

I noticed inconsistent rendering behavior between this module and standard Selection field when using required="True"

The standard Selection field when required="True" renders the options without any blank line in the list:
image
image
When required="False" the Selection provides empty value as well:
image
image

However web_widget_dropdown_dynamic always adds blank line to the list even when there is no value selected even if required="True":
image
image

This comes down to propagating required property which this fix addresses and thus brings web_widget_dropdown_dynamic to be visually aligned with standard Selection widget.

I was also 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.

@Rad0van
Copy link
Copy Markdown
Author

Rad0van commented Apr 13, 2026

Seems I have messed up the branches. My first PR was done on 18.0 branch which is not the proper way and I didn't notice I did this one on top of it. Any suggestions what to do? Redo both? Merge them into one? Or?

Copy link
Copy Markdown
Member

@hbrunn hbrunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your first commit message has a type

Comment thread web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js Outdated
@hbrunn
Copy link
Copy Markdown
Member

hbrunn commented Apr 14, 2026

Seems I have messed up the branches. My first PR was done on 18.0 branch which is not the proper way and I didn't notice I did this one on top of it. Any suggestions what to do? Redo both? Merge them into one? Or?

keep this PR and close the previous one, seems nobody reviewed this anyways

@Rad0van Rad0van changed the title [18.0][web_widget_dropdown_dynamic][FIX]: propagate required prop [18.0][web_widget_dropdown_dynamic][FIX]: propagate required prop and value dissappearing afetr losing focus when used in list view Apr 15, 2026
@Rad0van
Copy link
Copy Markdown
Author

Rad0van commented Apr 15, 2026

Seems I have messed up the branches. My first PR was done on 18.0 branch which is not the proper way and I didn't notice I did this one on top of it. Any suggestions what to do? Redo both? Merge them into one? Or?

keep this PR and close the previous one, seems nobody reviewed this anyways

Did as you proposed.

@Rad0van Rad0van changed the title [18.0][web_widget_dropdown_dynamic][FIX]: propagate required prop and value dissappearing afetr losing focus when used in list view [18.0][web_widget_dropdown_dynamic][FIX]: propagate required prop and value dissappearing after losing focus when used in list view Apr 15, 2026
@hbrunn
Copy link
Copy Markdown
Member

hbrunn commented Apr 16, 2026

looks like you undid the required commit though. please squash commits in the end to have one for the prop, one for the string property+test, one for contributors

@Rad0van Rad0van force-pushed the fix-web_widget_dropdown_dynamic-propagate_required branch 2 times, most recently from b26e606 to 6c3aab1 Compare April 16, 2026 13:03
@Rad0van
Copy link
Copy Markdown
Author

Rad0van commented Apr 16, 2026

looks like you undid the required commit though. please squash commits in the end to have one for the prop, one for the string property+test, one for contributors

Should be OK now I hope.

@hbrunn
Copy link
Copy Markdown
Member

hbrunn commented Apr 16, 2026

I can live with you having squashed everything to one commit, but please fix the typos in the commit message

…ocus when used in list view, propagate required prop
@Rad0van Rad0van force-pushed the fix-web_widget_dropdown_dynamic-propagate_required branch from 6c3aab1 to 122def0 Compare April 16, 2026 15:41
@Rad0van
Copy link
Copy Markdown
Author

Rad0van commented Apr 16, 2026

I can live with you having squashed everything to one commit, but please fix the typos in the commit message

Oh, stupid me. I didn't properly read what you wrote - one for prop and one for the rest. Sorry. Fixed the typos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:web_widget_dropdown_dynamic Module web_widget_dropdown_dynamic series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants