How to Add a Field to the Search Panel in Odoo 18
By Braincuber Team
Published on January 20, 2026
The Search Panel is that left sidebar in tree and kanban views where you can click categories to instantly filter records. It's great for quick navigation—but out of the box, it only shows a handful of fields. What if you want to filter by a custom field, like "Project Type" or "Skill Level"? This tutorial shows you how to add a custom Many2one field to an existing search panel in Odoo 18.
We'll use a practical example: adding a Skill Category field to the Employees module so HR can filter employees by their primary skill set (e.g., "Development", "Design", "Management") directly from the search panel.
What You'll Build: A custom module that adds a "Skill Category" dropdown to the Employee form and displays it in the search panel for one-click filtering.
Module Structure
├── __init__.py
├── __manifest__.py
├── models/
│ ├── __init__.py
│ ├── hr_skill_category.py
│ └── hr_employee.py
├── security/
│ └── ir.model.access.csv
└── views/
├── hr_skill_category_views.xml
└── hr_employee_views.xml
Step-by-Step Implementation
Create the Skill Category Model
First, define a new model to hold the skill categories.
from odoo import models, fields
class HrSkillCategory(models.Model):
_name = 'hr.skill.category'
_description = 'Employee Skill Category'
name = fields.Char(
string="Category Name",
required=True,
help="Name of the skill category (e.g., Development, Design, Management)"
)
color = fields.Integer(string="Color Index")
Extend the Employee Model
Add a Many2one field to link employees to skill categories.
from odoo import models, fields
class HrEmployee(models.Model):
_inherit = 'hr.employee'
skill_category_id = fields.Many2one(
comodel_name='hr.skill.category',
string="Skill Category",
help="Primary skill category for this employee"
)
Set Up Security Access
Grant read/write access to the new model.
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_hr_skill_category,access_hr_skill_category,model_hr_skill_category,,1,1,1,1
Create Views for Skill Category
Define list and form views plus a menu item for managing categories.
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- List View -->
<record id="hr_skill_category_view_list" model="ir.ui.view">
<field name="name">hr.skill.category.view.list</field>
<field name="model">hr.skill.category</field>
<field name="arch" type="xml">
<list>
<field name="name"/>
</list>
</field>
</record>
<!-- Form View -->
<record id="hr_skill_category_view_form" model="ir.ui.view">
<field name="name">hr.skill.category.view.form</field>
<field name="model">hr.skill.category</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="name"/>
</group>
</sheet>
</form>
</field>
</record>
<!-- Action -->
<record id="action_hr_skill_category" model="ir.actions.act_window">
<field name="name">Skill Categories</field>
<field name="res_model">hr.skill.category</field>
<field name="view_mode">list,form</field>
</record>
<!-- Menu under HR Configuration -->
<menuitem id="menu_hr_skill_category"
name="Skill Categories"
parent="hr.menu_human_resources_configuration"
action="action_hr_skill_category"
sequence="25"/>
</odoo>
Add Field to Form and Search Panel
This is the key step—inherit the employee views and add the field to both the form and search panel.
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Add field to Employee Form -->
<record id="view_employee_form_inherit_skill" model="ir.ui.view">
<field name="name">hr.employee.form.inherit.skill.category</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='category_ids']" position="after">
<field name="skill_category_id"/>
</xpath>
</field>
</record>
<!-- Add field to Search Panel -->
<record id="view_employee_filter_inherit_skill" model="ir.ui.view">
<field name="name">hr.employee.search.inherit.skill.category</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_filter"/>
<field name="arch" type="xml">
<xpath expr="//searchpanel" position="inside">
<field name="skill_category_id" icon="fa-lightbulb-o"/>
</xpath>
</field>
</record>
</odoo>
Key Line: The <field name="skill_category_id" icon="fa-lightbulb-o"/> inside <searchpanel> is what adds your field to the left sidebar. The icon attribute is optional but makes it visually distinctive.
Define the Manifest
Register all files and dependencies.
{
'name': 'HR Skill Category Search Panel',
'version': '18.0.1.0.0',
'category': 'Human Resources',
'summary': 'Add skill category filter to Employee search panel',
'depends': ['hr'],
'data': [
'security/ir.model.access.csv',
'views/hr_skill_category_views.xml',
'views/hr_employee_views.xml',
],
'installable': True,
'auto_install': False,
'application': False,
'license': 'LGPL-3',
}
Result After Installation
After installing the module:
- Employee Form: New "Skill Category" dropdown appears after the Tags field.
- Configuration Menu: HR - Configuration - Skill Categories to manage categories.
- Search Panel: In the Employee list/kanban view, the left sidebar now shows "Skill Category" with clickable filters for each category.
How It Works: When you click "Development" in the search panel, Odoo automatically filters to show only employees where skill_category_id matches the "Development" record. No additional code needed—the ORM handles the filtering.
Conclusion
Adding a field to the search panel requires three components: the new model, a Many2one link on the target model, and an XPath injection into the <searchpanel> element. This pattern works for any module—Sales, Inventory, Projects—not just HR. It's a minimal-code solution that significantly improves usability for users who need to filter records by custom criteria.
