Skip to content

[18.0][MIG] base_name_search_multi_lang: Migration to 18.0 - #3697

Open
ROBBYHOOD9 wants to merge 14 commits into
OCA:18.0from
ecosoft-odoo:18.0-mig-base_name_search_multi_lang
Open

[18.0][MIG] base_name_search_multi_lang: Migration to 18.0#3697
ROBBYHOOD9 wants to merge 14 commits into
OCA:18.0from
ecosoft-odoo:18.0-mig-base_name_search_multi_lang

Conversation

@ROBBYHOOD9

Copy link
Copy Markdown

Migration base_name_search_multi_lang from 14.0 to 18.0

1. Module Version

Updated the module version to align with Odoo 18.

2. Python Code Updates

  • Replaced the deprecated name_search patching mechanism with _search_display_name().
  • Updated the multi-language search implementation to comply with Odoo 18 APIs.

3. View Migration

  • Updated the XPath expression to match the Odoo 18 view structure.

4. Test Updates

  • Updated tests to use BaseCommon and Odoo 18 testing conventions.

5. Project Maintenance

  • Applied pre-commit fixes and updated project configuration files.

@OCA-git-bot OCA-git-bot added series:18.0 mod:base_name_search_multi_lang Module base_name_search_multi_lang labels Aug 7, 2026


@tools.ormcache("model")
def _get_model_name_search_multi_lang(self, model):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

any reason not to move this into the base model too?

Comment on lines +14 to +15
Please also note that, this search feature is available only on Many2one
field.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Please also note that, this search feature is available only on Many2one
field.
Please also note that this search feature is available only on Many2one
fields.

Comment on lines +11 to +12
"Search Translated Name". Search by Thai name, "เก้าอี้", now find the
product "Chair".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"Search Translated Name". Search by Thai name, "เก้าอี้", now find the
product "Chair".
"Search Translated Name". Searching by Thai name, "เก้าอี้", now finds the
product "Chair".

@@ -0,0 +1,15 @@
This module extends the name search feature to use other translated
language.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
language.
languages.


For example, if a product name in English is "Chair", and Thai is "เก้าอี้"

Given user language preference is English, when user type name to search

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Given user language preference is English, when user type name to search
Given user language preference is English, when user types name to search

@@ -0,0 +1,3 @@
Just type into any field with translated term, such as Product on a Sale

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Just type into any field with translated term, such as Product on a Sale
Just type into any field with translated names, such as Product on a Sales

return bool(data and data[0]["name_search_multi_lang"])


class Base(models.AbstractModel):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please move this into its own file

ids.update(model_lang._search(lang_domain))
if not ids:
return domain
return expression.OR([domain, [("id", "in", list(ids))]])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does this work correctly with negative term operators? but then it's unclear to me what we want as result here, as obviously no Thai name will match an English name and vice versa. Possibly exit early if operator is in expression.NEGATIVE_TERM_OPERATORS?

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

Labels

mod:base_name_search_multi_lang Module base_name_search_multi_lang series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants