oca-hr/odoo-bringout-oca-hr-hr_employee_lastnames/hr_employee_lastnames/hooks.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
1.2 KiB
Python

from odoo import SUPERUSER_ID
from odoo.api import Environment
def post_init_hook(cr, _):
# This SQL statement is necessary to call _install_employee_lastnames() and
# set name fields correctly.
#
# After the installation, previously the dependency hr_employee_firstname
# splitting the name into two parts: firstname and lastname, so for this
# module to be able to process the new field lastmane2 it is necessary to
# reset the values to empty to be able to correctly set the three fields
# (firstname, lastname and lastname2).
#
# For example:
# After install hr_employee_fisrtname and before install hr_employee_lastnames:
# name = 'John Peterson Clinton'
# firstname = 'John'
# lastname = 'Peterson Clinton'
#
# After install hr_employee_lastnames:
# name = 'John Peterson Clinton'
# firstname = 'John'
# lastname = 'Peterson'
# lastname2 = 'Clinton'
cr.execute("UPDATE hr_employee SET firstname = NULL, lastname = NULL")
env = Environment(cr, SUPERUSER_ID, {})
env["hr.employee"]._install_employee_lastnames()
env["ir.config_parameter"].sudo().set_param("employee_names_order", "first_last")