[ADD] developer/reference/frontend: document new selection badges#16477
Closed
[ADD] developer/reference/frontend: document new selection badges#16477
Conversation
Collaborator
aab-odoo
reviewed
Feb 20, 2026
6bff0ef to
57b2187
Compare
aab-odoo
approved these changes
Feb 24, 2026
AntoineVDV
approved these changes
Feb 24, 2026
| Badge Selection (`selection_badge`) | ||
| This is a subfield of `selection` field, but specialized to display all the | ||
| valid choices as rectangular badges. | ||
| Badges Selection (``badges_selection``) |
Collaborator
There was a problem hiding this comment.
My 2 cents: badge_selection has a better English tune to it. Also it saves a whole character 😄
Collaborator
There was a problem hiding this comment.
I just realized that badges_many2one follows this one and that you might to be consistent with its naming 😅
Task-5270283 Related Community PR: odoo/odoo#243855 Related Enterprise PR: odoo/enterprise#104338
57b2187 to
e2c12b6
Compare
Contributor
|
robodoo r+ |
robodoo
pushed a commit
that referenced
this pull request
Feb 27, 2026
Task-5270283 Related Community PR: odoo/odoo#243855 Related Enterprise PR: odoo/enterprise#104338 closes #16477 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
robodoo
pushed a commit
to odoo/odoo
that referenced
this pull request
Feb 27, 2026
…ction This change restructures the existing selection_badge widget by splitting it into two specialized versions. By using a shared base component, we've separated the core rendering logic from the data-fetching logic. The new BaseBadgeField now handles the visual display, while two specific widgets handle the different data types. New widgets: badges_many2one for relational fields. It handles searching and reading records from the database while supporting domain filters and related icons. The second, badges_selection, is for standard selection fields and includes support for icon mapping and filtering options. We've also introduced a new behavior, when the number of options exceeds a defined badgeLimit, the widget automatically switches to a searchable dropdown menu (SelectMenu). Additionally, we optimized background data requests and standardized all icons to a consistent small size. This update cleans up the codebase by removing several redundant or outdated widgets that are no longer necessary under this new architecture. All relevant tests have been updated to ensure the new split logic works correctly across different use cases. Task-5270283 Related: odoo/enterprise#104338 Related: odoo/documentation#16477 Part-of: #243855 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
robodoo
pushed a commit
to odoo/odoo
that referenced
this pull request
Feb 27, 2026
Introduce a computed `icon` field on `hr.work.location` to provide icon classes based on the `location_type`. This enables the `BadgesMany2oneField` widget to display representative icons for each location choice using the field name provided with relatedIconField option. Task-5270283 Related: odoo/enterprise#104338 Related: odoo/documentation#16477 Part-of: #243855 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
robodoo
added a commit
to odoo/odoo
that referenced
this pull request
Feb 27, 2026
… add max badges option ### **This PR addresses:** Merging the `selection_badge_icons` widget from `mail` into the standard `selection_badge` widget in `web`. This unifies the badge logic across the framework and introduces a responsive fallback for fields with many options. ### **Key Improvements:** * **Integrated Icon Support:** The `selection_badge` widget now supports icons via `related_icon_field` for many2one fields and `icon_mapping` for selection fields. * **Optimized RPC:** When icons are requested, the widget now uses `search_read` instead of `name_search`. This allows fetching both the display name and the icon in a **single RPC request**. * **Smart Dropdown Fallback:** A new `max_badge` option allows the widget to automatically switch to a `SelectMenu` dropdown if the number of options exceeds the limit, preventing UI clutter. * **Offline Resilience:** Added handling for `ConnectionLostError` to ensure the widget displays the current record data even when the server is unreachable. * **Cleanup:** The legacy `selection_badge_icons` widget has been removed from the `mail` module. ### **New Option:** * **max_badge:** A threshold number to automatically switch from badges to a dropdown menu. **Task-5270283** **Related Enterprise PR:** odoo/enterprise#104338 closes #243855 Related: odoo/documentation#16477 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
VincentJanssen-Code
pushed a commit
to odoo-dev/odoo
that referenced
this pull request
Mar 4, 2026
…ction This change restructures the existing selection_badge widget by splitting it into two specialized versions. By using a shared base component, we've separated the core rendering logic from the data-fetching logic. The new BaseBadgeField now handles the visual display, while two specific widgets handle the different data types. New widgets: badges_many2one for relational fields. It handles searching and reading records from the database while supporting domain filters and related icons. The second, badges_selection, is for standard selection fields and includes support for icon mapping and filtering options. We've also introduced a new behavior, when the number of options exceeds a defined badgeLimit, the widget automatically switches to a searchable dropdown menu (SelectMenu). Additionally, we optimized background data requests and standardized all icons to a consistent small size. This update cleans up the codebase by removing several redundant or outdated widgets that are no longer necessary under this new architecture. All relevant tests have been updated to ensure the new split logic works correctly across different use cases. Task-5270283 Related: odoo/enterprise#104338 Related: odoo/documentation#16477 Part-of: odoo#243855 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
VincentJanssen-Code
pushed a commit
to odoo-dev/odoo
that referenced
this pull request
Mar 4, 2026
Introduce a computed `icon` field on `hr.work.location` to provide icon classes based on the `location_type`. This enables the `BadgesMany2oneField` widget to display representative icons for each location choice using the field name provided with relatedIconField option. Task-5270283 Related: odoo/enterprise#104338 Related: odoo/documentation#16477 Part-of: odoo#243855 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Task-5270283
Related Community PR: odoo/odoo#243855
Related Enterprise PR: odoo/enterprise#104338