Skip to content

[18.0][ADD] web_widget_autocomplete: Char autocomplete widget - #3667

Open
ivs-cetmix wants to merge 3 commits into
OCA:18.0from
cetmix:18.0-add-web_widget_autocomplete
Open

ivs-cetmix wants to merge 3 commits into
OCA:18.0from
cetmix:18.0-add-web_widget_autocomplete

Conversation

@ivs-cetmix

@ivs-cetmix ivs-cetmix commented Sep 14, 2026

Copy link
Copy Markdown
Member

Depends on:

Odoo 18 has no backend Char widget that typeahead-fills from a consumer-supplied model method. Partner autocomplete is IAP-only, and web_widget_dropdown_dynamic is a closed select, not typeahead.

This addon registers widget="autocomplete" on Char fields, calls a public @api.model method with the typed string, and on select writes the Char plus any extra Char/Integer keys that exist on the model and in the view.

Task 5613

Made with AI assistance - mostly Cursor - checked manually. If someone is going to call this "yet another AI slope" - do it without using your Claude while reviewing this PR 😆

There is also a dedicated module for the functional testing, it's installed automatically on runboat deployments.
Test flow is really simple and also allows you to discover beautiful cities of Umbria:

  • Open a contact form and edit City. Type at least three characters
    (try “Per”, “Ass”, or “cit”) to see Umbria cities.
  • Selecting a row writes that name into City. You can still type a city that is not in the list.

@OCA-git-bot OCA-git-bot added series:18.0 mod:web_widget_autocomplete Module web_widget_autocomplete labels Sep 14, 2026
@ivs-cetmix
ivs-cetmix marked this pull request as draft September 14, 2026 19:04
@ivs-cetmix
ivs-cetmix force-pushed the 18.0-add-web_widget_autocomplete branch 5 times, most recently from ec5664b to 977906b Compare September 14, 2026 21:16
@OCA-git-bot OCA-git-bot added the mod:web_widget_autocomplete_demo Module web_widget_autocomplete_demo label Sep 14, 2026
@ivs-cetmix
ivs-cetmix force-pushed the 18.0-add-web_widget_autocomplete branch from 9089de6 to f5e428d Compare September 14, 2026 21:51
@ivs-cetmix
ivs-cetmix marked this pull request as ready for review September 14, 2026 22:00
@ivs-cetmix
ivs-cetmix force-pushed the 18.0-add-web_widget_autocomplete branch 3 times, most recently from 81ee7f7 to c9e5c8c Compare September 15, 2026 19:31
@OCA-git-bot OCA-git-bot added the mod:web_widget_pattern Module web_widget_pattern label Sep 15, 2026
@ivs-cetmix
ivs-cetmix force-pushed the 18.0-add-web_widget_autocomplete branch from c9e5c8c to b68e45b Compare September 15, 2026 19:53
@OCA-git-bot OCA-git-bot removed the mod:web_widget_pattern Module web_widget_pattern label Sep 15, 2026
@ivs-cetmix
ivs-cetmix force-pushed the 18.0-add-web_widget_autocomplete branch from 06d16a9 to b255fcb Compare September 15, 2026 20:11

@Aldeigja Aldeigja left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Functional LGTM

@ivs-cetmix
ivs-cetmix force-pushed the 18.0-add-web_widget_autocomplete branch from fcf5214 to f0fba17 Compare September 16, 2026 07:44
ivs-cetmix and others added 2 commits September 16, 2026 11:14
Odoo 18 has no backend Char widget that typeahead-fills from a
consumer-supplied model method. This addon reuses web.AutoComplete
so integrators can hook any public @api.model method. HOOT is
selected with WebSuite hash ids so sibling WebWidget* suites do
not pick these tests up via fuzzy matching.

Task 5613

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the widget addon generic. This demo wires partner City to an
in-memory list of Italian and world cities so selecting a suggestion
also fills ZIP on the contact form.

Task 5613

Co-authored-by: Cursor <cursoragent@cursor.com>
@ivs-cetmix
ivs-cetmix force-pushed the 18.0-add-web_widget_autocomplete branch from f0fba17 to 2fd32eb Compare September 16, 2026 09:15
@ivs-cetmix

Copy link
Copy Markdown
Member Author

Hey @OCA/web-maintainers don't get me wrong - not asking for a fast track here, but would appreciate someone having a look at this. It's already being in use, however I cannot review my code myself 😄

@yostashiro

Copy link
Copy Markdown
Member

Nice feature! Tried it on Runboat, and the value selection didn't always seem to work when I picked a value using the up/down arrow keys + Enter. It worked fine when I clicked on the value.
2026-09-16_22-05-19

@hbrunn

hbrunn commented Sep 16, 2026

Copy link
Copy Markdown
Member

@ivs-cetmix much less pushiness please. I planned to review this on Friday, but will bump it down the list in order not to reward such behavior

@ivs-cetmix

Copy link
Copy Markdown
Member Author

@yostashiro thank you, will check!
@hbrunn I wasn't aware of your list, noted.

Enter is handled by both AutoComplete and useInputField. Core only
stopPropagations, so the Char hook can still commit the typed
string and overwrite the highlighted row. Stop the hook and sync
the input to the selected label before onSelect.

Task 5613

Co-authored-by: Cursor <cursoragent@cursor.com>
@ivs-cetmix

Copy link
Copy Markdown
Member Author

@yostashiro this was fixed, could you please check it again?

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

Labels

mod:web_widget_autocomplete_demo Module web_widget_autocomplete_demo mod:web_widget_autocomplete Module web_widget_autocomplete series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants