[ADD] search_ux: search products and partners by keywords and configurable fields - #441
Open
mav-adhoc wants to merge 1 commit into
Open
[ADD] search_ux: search products and partners by keywords and configurable fields#441mav-adhoc wants to merge 1 commit into
mav-adhoc wants to merge 1 commit into
Conversation
Contributor
mav-adhoc
force-pushed
the
19.0-t-72472-mav
branch
3 times, most recently
from
August 24, 2026 19:31
b672c8c to
db55487
Compare
…rable fields Adds a "search keywords" field on products and partners for aliases and trade names, and a per model configuration to add fields and related sources to the search. It only hooks into the extension points Odoo documents: name_search on product.template and product.product (calling super and completing the suggestion list) and _search_display_name on res.partner. Only those models inherit the mixin, and the extra criteria are built as a single domain resolved in a single query, which runs only when the native search did not fill the limit. The configuration lives on its own model, restricted to the models that inherit the mixin, and rejects on save what cannot be sustained: html, binary and non stored fields, wrong paths, group restricted fields and more than five fields per model. Customer specific sources are added from customer modules by inheriting _get_extra_search_domains, without forking this module.
mav-adhoc
force-pushed
the
19.0-t-72472-mav
branch
from
August 24, 2026 20:05
db55487 to
83980e3
Compare
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.

Sustainable replacement for
base_name_search_improved(OCA), on products and partners.Task: https://www.adhoc.inc/odoo/all-tasks/12857/all-tasks/72472
What it does out of the box
product.templateandres.partner, for aliases, nicknames and trade names.How it hooks
product.template,product.productname_search: callssuper()and completes the suggestion list only if the native cascade did not filllimitres.partner_search_display_name: adds the fields to the same declarative domain, no extra queryNo
_inherit = "base", no_register_hook, no monkeypatching of the registry. Only the two models inherit the mixin, explicitly.Multi word: the term is split and all words must appear, in any order and in any configured field, built as a single domain resolved in a single query.
What the consultant configures
Settings > Technical > "Extended Search", per model: fields to include (model fields, Studio fields and forward paths like
product_tmpl_id.my_field), related sources for products (lots/serials, vendor code, packaging barcodes), minimum characters before triggering (default 3), and archiving to turn it off completely.It rejects on save, with an explanation: html fields, binary/attachment fields, non stored fields, wrong paths, group restricted fields and more than 5 fields per model (
search_ux.max_fields).Customization
A customer module adds its own source by inheriting a single extension point, without forking:
Test plan
13 tests, green on a 19.0 database with only
search_uxinstalled:They discriminate: neutralizing
_get_extra_search_domainsmakes 4 of them fail (keywords on product, on template, on partner, multi word and minimum characters).Covered: keywords on the three models, native behaviour untouched without configuration, the extended search not running when the native one fills the limit, multi word in a single query, minimum characters, turning it off, the received domain being honoured, the extension point, and every rejected configuration.
Not included on purpose
Typo correction, lot reservation when the product is found by serial, and searching inside html descriptions.