| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 48 |
| Technical Name |
pattern_search |
| License | LGPL-3 |
Pattern Search
Autocomplete search in the form view
Autocomplete search in the search view
Pattern search in the search view
ð¢ 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 many2x 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
many2xfields 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
-
Autocomplete search in the form view
In your form view XML, add
context="{'pattern_search': True}"to themany2xfield definition.Example:
<form> <field name="employee_id" context="{'pattern_search': True}" /> </form>Once enabled, the field will support pattern matching: typing
muhrawill match "Muhammad Rajeel", andrjlwill also return similar results even if the full name doesn't begin with it. -
Autocomplete search in the search view
In your search view XML, add
context="{'pattern_search': True}"to the field definition.Example:
<search> <field name="department_id" context="{'pattern_search': True}" /> </search>Once enabled, the field will support pattern matching: typing
proserwill match "Professional Services", -
Pattern search in the search view
Same as #2
Example:
<search> <field name="name" context="{'pattern_search': True}" /> </search>Once enabled, the field will support pattern matching: searching
muhrawill match "Muhammad Rajeel",Use with
filter_domain:If using
filter_domainin search field, useraw_valueinstead ofselfin domainExample:
<search> <field name="name" string="Employee" filter_domain="['|', ('work_email', 'ilike', self), ('name', 'ilike', raw_value)]" context="{'pattern_search': True}"/> </search>work_emailwill be searched without pattern butnamewill be searched with pattern
Please log in to comment on this module