Skip to content

[ADD] developer/reference/frontend: document new selection badges#16477

Closed
Oussema39 wants to merge 1 commit intomasterfrom
master-badge-overflow-limit-5270283-ouelh
Closed

[ADD] developer/reference/frontend: document new selection badges#16477
Oussema39 wants to merge 1 commit intomasterfrom
master-badge-overflow-limit-5270283-ouelh

Conversation

@Oussema39
Copy link

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

@robodoo
Copy link
Collaborator

robodoo commented Feb 20, 2026

Pull request status dashboard

@Oussema39 Oussema39 requested a review from aab-odoo February 20, 2026 09:29
@Oussema39 Oussema39 force-pushed the master-badge-overflow-limit-5270283-ouelh branch from 6bff0ef to 57b2187 Compare February 23, 2026 09:47
@Oussema39 Oussema39 marked this pull request as ready for review February 23, 2026 11:41
@C3POdoo C3POdoo requested a review from a team February 23, 2026 12:57
@aab-odoo aab-odoo requested a review from AntoineVDV February 24, 2026 12:57
Copy link
Collaborator

@AntoineVDV AntoineVDV left a comment

Choose a reason for hiding this comment

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

@robodoo delegate+ delegate=@aab-odoo

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``)
Copy link
Collaborator

Choose a reason for hiding this comment

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

My 2 cents: badge_selection has a better English tune to it. Also it saves a whole character 😄

Copy link
Collaborator

Choose a reason for hiding this comment

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

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
@Oussema39 Oussema39 force-pushed the master-badge-overflow-limit-5270283-ouelh branch from 57b2187 to e2c12b6 Compare February 25, 2026 09:31
@aab-odoo
Copy link
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>
@robodoo robodoo closed this Feb 27, 2026
@robodoo robodoo added the 19.3 label Feb 27, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants