Repository navigation
Conversation
CRogos
suggested changes
Nov 18, 2026
CRogos
left a comment
Contributor
There was a problem hiding this comment.
@mdurepos could you rebase and solve the conflicts.
Also make sure to use Assisted-by: instead of Co-Authored-By: in the commit message. (In this and all other AI generated PRs)
I also think you should close the other two PRs and we review everything in this PR?
The field_color/colors options had no effect on many2one fields in 19.0: - Many2OneField.m2oProps and the computeM2OProps override forwarded searchLimit but not fieldColor/fieldColorOptions, so the options never reached Many2XAutocomplete; Many2One did not declare them either. - loadOptionsSource matched suggestions on option.value, which 19.0 suggestions no longer have: the record is in option.data.record. Adds a hoot test covering the dropdown colouring. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Adds a color_style option next to field_color/colors. "text" (the default) keeps the current text colouring unchanged. "bar" draws a thin accent bar on the left of each suggestion and leaves the text alone, so contrast does not suffer in either theme. With "bar", Bootstrap theme colour names (success, info, warning, ...) resolve through Odoo's theme CSS variables and so follow the light or dark theme; any other value is used as a CSS colour. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Adds field_icon/icons options, mirroring field_color/colors: icons maps a value of field_icon to a Font Awesome class, shown as a fixed-width muted icon on the left of each suggestion. Values without an entry get no icon, and the colour and icon fields are fetched in the same request. Also replaces the nested option/record loop with an id lookup. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
mdurepos
force-pushed
the
19.0-imp-web_m2x_options-field_icon
branch
from
November 21, 2026 15:59
afae4e8 to
45bcf96
Compare
Author
|
@CRogos thanks for the review. Done:
|
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.
This PR now carries all three commits, rebased on 19.0, so they can be reviewed together. It supersedes #3696 (field_color fix) and #3697 (
color_style), which are closed. Each commit stands on its own:[FIX] web_m2x_options: field_color on 19.0[IMP] web_m2x_options: color_style option[IMP] web_m2x_options: field_icon option1. Fix
field_coloron 19.0On 19.0 the
field_color/colorsoptions have no effect on many2one fields: suggestions are never coloured.Two independent causes:
Many2OneField.m2oPropsand thecomputeM2OPropsoverride forwardsearchLimitbut notfieldColor/fieldColorOptions, andMany2Onedoes not declare them, soMany2XAutocompletenever receives them.option.value, which 19.0 suggestions no longer carry: the record is inoption.data.record. Thesearch_readthen gets no ids and nothing is coloured. "Search More" / "Create" entries have no record and are now skipped.The module's template patch that applies
option.stylewas already correct.2.
color_styleoptionfield_colorcolours the suggestion text. In practice that gives poor contrast, and a fixed CSS colour cannot suit both the light and the dark theme.This adds a
color_styleoption:text(the default, or no option at all): exactly the current behaviour,color:<value>.bar: a thin accent bar on the left of each suggestion (an insetbox-shadow, so there is no layout shift). The text is left alone.With
bar, Bootstrap theme colour names (primary,secondary,success,info,warning,danger,light,dark) resolve through Odoo's theme CSS variables. Odoo compiles Bootstrap without thebs-prefix, so these are--successetc., and they are defined with different values inweb.assets_webandweb.assets_web_dark, so the bar follows the theme. Any other value is used as a CSS colour.3.
field_iconoptionColour alone needs a legend. An icon per value can be read at a glance, e.g. telling contacts from delivery and invoice addresses in a long partner list.
This adds
field_icon/icons, mirroringfield_color/colors:iconsmaps a value offield_iconto a Font Awesome class. The icon renders as a fixed-width, muted<i aria-hidden="true">before the label.field_color/color_style. Both fields are fetched in the samesearch_read.The nested option/record matching loop is replaced with an id lookup. That keeps eslint's
max-depthhappy now that there are two things to apply per record.color_styleandfield_iconare supported on many2one and many2many tags, likefield_color, and documented inreadme/USAGE.md.Rebase notes
19.0 has since gained the field-level
create/create_editoverrides (m2xOverrideProps). The conflicts were purely additive: the override props and the colour/icon props are now declared and forwarded side by side, and the quick-create check keeps the override test.Tests
tests/test_js.pyruns the hoot suites:static/tests/field_color.test.js: suggestions are coloured byfield_color(fails before commit 1, passes after);color_style: 'text'keeps the current output;bardraws the accent bar for a theme name and a raw colour, asserting the computedbox-shadowactually resolves so an undefined variable cannot pass silently.static/tests/field_icon.test.js: mapped values get their icon, unmapped values get none, and no icon appears without the option.🤖 Generated with Claude Code