Skip to Content
Menu

Search many2one records with pattern

by
Odoo
v 17.0 Third Party 40
Download for v 17.0 Deploy on Odoo.sh
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 14
Technical Name many2one_pattern_search
LicenseLGPL-3
Versions 17.0 18.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 14
Technical Name many2one_pattern_search
LicenseLGPL-3
Versions 17.0 18.0

Field Technical Name

Cover

📢 Available for Hire!

Looking for a skilled and reliable Odoo Developer to bring your business ideas to life? or to fix things? or to analyze unwanted results? or to do whatever in odoo

Let’s build something great together! I specialize in custom module development, ERP implementation, and performance tuning tailored to your needs.


📬 Hire Me wa.me/923482852693 /rajeelzahid

Overview

This module enhances the search behavior of many2one fields in Odoo by introducing a pattern-based search mechanism. Instead of relying solely on the default ilike search, it allows users to search by meaningful fragments of the name. This is particularly helpful in cases where records (e.g. employees) share common prefixes like "Muhammad", enabling quicker and more intuitive access to relevant records.

Key Features

  • Improves usability of many2one fields with large datasets
  • Supports pattern-based searching (e.g., "muhra" matches "Muhammad Rajeel")
  • Context-aware as only applies when explicitly enabled
  • Lightweight and non-intrusive to existing logic
  • Compatible with all standard and custom models

How to Use

  1. In your form view XML, add context="{'pattern_search': True}" to the many2one field definition.
  2. Example:
  <field name="employee_id" context="{'pattern_search': True}" />
  

Once enabled, the field will support pattern matching: typing muhra will match "Muhammad Rajeel", and rjl will also return similar results even if the full name doesn't begin with it.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.