oca-hr/odoo-bringout-oca-hr-hr_department_code/hr_department_code/models/hr_department.py
Ernad Husremovic dfcda4100c Move all OCA HR modules from oca-technical to dedicated oca-hr submodule
Reorganized 67 HR-related modules for better structure:
- Moved all odoo-bringout-oca-hr-* packages from packages/oca-technical/
- Now organized in dedicated packages/oca-hr/ submodule
- Includes attendance, expense, holiday, employee, and contract modules
- Maintains all module functionality while improving project organization

This creates a cleaner separation between general technical modules
and HR-specific functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 17:11:28 +02:00

29 lines
867 B
Python

# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class Department(models.Model):
_inherit = "hr.department"
_order = "code, name"
code = fields.Char()
def name_get(self):
res = []
for dep in self:
name = dep.name
if dep.code:
name = ("[%(code)s] %(name)s") % {"code": dep.code, "name": name}
res.append((dep.id, name))
return res
@api.model
def name_search(self, name, args=None, operator="ilike", limit=100):
args = args or []
domain = []
if name:
domain = ["|", ("code", operator, name), ("name", operator, name)]
department = self.search(domain + args, limit=limit)
return department.name_get()