Initial commit: OCA Technical packages (595 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:03 +02:00
commit 2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions

View file

@ -0,0 +1,44 @@
# HR Employee First Name and Two Last Names
Odoo addon: hr_employee_lastnames
## Installation
```bash
pip install odoo-bringout-oca-hr-hr_employee_lastnames
```
## Dependencies
This addon depends on:
- hr_employee_firstname
## Manifest Information
- **Name**: HR Employee First Name and Two Last Names
- **Version**: 16.0.1.0.2
- **Category**: Human Resources
- **License**: AGPL-3
- **Installable**: True
## Source
Based on [OCA/hr](https://github.com/OCA/hr) branch 16.0, addon `hr_employee_lastnames`.
## License
This package maintains the original AGPL-3 license from the upstream Odoo project.
## Documentation
- Overview: doc/OVERVIEW.md
- Architecture: doc/ARCHITECTURE.md
- Models: doc/MODELS.md
- Controllers: doc/CONTROLLERS.md
- Wizards: doc/WIZARDS.md
- Install: doc/INSTALL.md
- Usage: doc/USAGE.md
- Configuration: doc/CONFIGURATION.md
- Dependencies: doc/DEPENDENCIES.md
- Troubleshooting: doc/TROUBLESHOOTING.md
- FAQ: doc/FAQ.md

View file

@ -0,0 +1,32 @@
# Architecture
```mermaid
flowchart TD
U[Users] -->|HTTP| V[Views and QWeb Templates]
V --> C[Controllers]
V --> W[Wizards Transient Models]
C --> M[Models and ORM]
W --> M
M --> R[Reports]
DX[Data XML] --> M
S[Security ACLs and Groups] -. enforces .-> M
subgraph Hr_employee_lastnames Module - hr_employee_lastnames
direction LR
M:::layer
W:::layer
C:::layer
V:::layer
R:::layer
S:::layer
DX:::layer
end
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
```
Notes
- Views include tree/form/kanban templates and report templates.
- Controllers provide website/portal routes when present.
- Wizards are UI flows implemented with `models.TransientModel`.
- Data XML loads data/demo records; Security defines groups and access.

View file

@ -0,0 +1,3 @@
# Configuration
Refer to Odoo settings for hr_employee_lastnames. Configure related models, access rights, and options as needed.

View file

@ -0,0 +1,3 @@
# Controllers
This module does not define custom HTTP controllers.

View file

@ -0,0 +1,5 @@
# Dependencies
This addon depends on:
- [hr_employee_firstname](../../odoo-bringout-oca-hr-hr_employee_firstname)

View file

@ -0,0 +1,4 @@
# FAQ
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
- Q: How to enable? A: Start server with --addon hr_employee_lastnames or install in UI.

View file

@ -0,0 +1,7 @@
# Install
```bash
pip install odoo-bringout-oca-hr-hr_employee_lastnames"
# or
uv pip install odoo-bringout-oca-hr-hr_employee_lastnames"
```

View file

@ -0,0 +1,13 @@
# Models
Detected core models and extensions in hr_employee_lastnames.
```mermaid
classDiagram
class hr_employee
class hr_employee_base
```
Notes
- Classes show model technical names; fields omitted for brevity.
- Items listed under _inherit are extensions of existing models.

View file

@ -0,0 +1,6 @@
# Overview
Packaged Odoo addon: hr_employee_lastnames. Provides features documented in upstream Odoo 16 under this addon.
- Source: OCA/OCB 16.0, addon hr_employee_lastnames
- License: LGPL-3

View file

@ -0,0 +1,3 @@
# Reports
This module does not define custom reports.

View file

@ -0,0 +1,8 @@
# Security
This module does not define custom security rules or access controls beyond Odoo defaults.
Default Odoo security applies:
- Base user access through standard groups
- Model access inherited from dependencies
- No custom row-level security rules

View file

@ -0,0 +1,5 @@
# Troubleshooting
- Ensure Python and Odoo environment matches repo guidance.
- Check database connectivity and logs if startup fails.
- Validate that dependent addons listed in DEPENDENCIES.md are installed.

View file

@ -0,0 +1,7 @@
# Usage
Start Odoo including this addon (from repo root):
```bash
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon hr_employee_lastnames
```

View file

@ -0,0 +1,3 @@
# Wizards
This module does not include UI wizards.

View file

@ -0,0 +1,92 @@
=========================================
HR Employee First Name and Two Last Names
=========================================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e3ad9ca8445db84cea2f6b86336a239e2277e208c08820c7e4ea30ad9d259fe8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github
:target: https://github.com/OCA/hr/tree/16.0/hr_employee_lastnames
:alt: OCA/hr
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/hr-16-0/hr-16-0-hr_employee_lastnames
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/hr&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows you to add firstname and lastnames (Father an Mother Last Name) in employee form,
and concatenate both in name field.
**Table of contents**
.. contents::
:local:
Usage
=====
#. Go to *Employees*
#. On the employee form view you will have 3 separate fields, one for Firstname, second for Lastname, both required and Mother's Last Name (optional).
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/hr/issues/new?body=module:%20hr_employee_lastnames%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Vauxoo
Contributors
~~~~~~~~~~~~
* Luis Escobar <lescobar@vauxoo.com>
* Hugo Adan <hugo@vauxoo.com>
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
.. |maintainer-luisg123v| image:: https://github.com/luisg123v.png?size=40px
:target: https://github.com/luisg123v
:alt: luisg123v
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-luisg123v|
This module is part of the `OCA/hr <https://github.com/OCA/hr/tree/16.0/hr_employee_lastnames>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View file

@ -0,0 +1,2 @@
from . import models
from .hooks import post_init_hook

View file

@ -0,0 +1,17 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "HR Employee First Name and Two Last Names",
"version": "16.0.1.0.2",
"author": "Vauxoo, Odoo Community Association (OCA)",
"maintainers": ["luisg123v"],
"website": "https://github.com/OCA/hr",
"license": "AGPL-3",
"category": "Human Resources",
"summary": "Split Name in First Name, Father's Last Name and Mother's Last Name",
"depends": ["hr_employee_firstname"],
"data": ["views/hr_views.xml"],
"post_init_hook": "post_init_hook",
"demo": [],
"test": [],
"installable": True,
}

View file

@ -0,0 +1,29 @@
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")

View file

@ -0,0 +1,45 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_employee_lastnames
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee_base
msgid "Basic Employee"
msgstr "Obični zaposlenik"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee
msgid "Employee"
msgstr "Zaposleni"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__firstname
msgid "First name"
msgstr "Ime"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname
msgid "Last name"
msgstr "Prezime"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname2
msgid "Second last name"
msgstr "Drugo prezime"

View file

@ -0,0 +1,51 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_employee_lastnames
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-12-07 11:06+0000\n"
"Last-Translator: QuiJoQuim <quim.rebull@gmail.com>\n"
"Language-Team: none\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee_base
msgid "Basic Employee"
msgstr "Empleat bàsic"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee
msgid "Employee"
msgstr "Empleat"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__firstname
msgid "First name"
msgstr "Nom"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname
msgid "Last name"
msgstr "Primer cognom"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname2
msgid "Second last name"
msgstr "Segon cognom"
#~ msgid "Last Modified on"
#~ msgstr "Darrera modificació el"

View file

@ -0,0 +1,61 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_employee_lastnames
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-31 12:31+0000\n"
"PO-Revision-Date: 2023-08-03 21:10+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee_base
msgid "Basic Employee"
msgstr "Empleado Básico"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee
msgid "Employee"
msgstr "Empleado"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__firstname
msgid "First name"
msgstr "Nombre Propio"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname
msgid "Last name"
msgstr "Primer Apellido"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname2
msgid "Second last name"
msgstr "Segundo Apellido"
#~ msgid "Display Name"
#~ msgstr "Mostrar nombre"
#~ msgid "ID"
#~ msgstr "ID (identificación)"
#~ msgid "Last Modified on"
#~ msgstr "Modificado por última vez el"
#~ msgid "No name set."
#~ msgstr "Sin nombre establecido."

View file

@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_employee_lastnames
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee_base
msgid "Basic Employee"
msgstr ""
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee
msgid "Employee"
msgstr ""
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__firstname
msgid "First name"
msgstr ""
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname
msgid "Last name"
msgstr ""
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname2
msgid "Second last name"
msgstr ""

View file

@ -0,0 +1,45 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_employee_lastnames
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee_base
msgid "Basic Employee"
msgstr ""
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee
msgid "Employee"
msgstr ""
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__firstname
msgid "First name"
msgstr ""
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname
msgid "Last name"
msgstr ""
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname2
msgid "Second last name"
msgstr ""

View file

@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_employee_lastnames
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-05-17 14:35+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.14.1\n"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee_base
msgid "Basic Employee"
msgstr "Dipendente base"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee
msgid "Employee"
msgstr "Dipendente"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__firstname
msgid "First name"
msgstr "Nome"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname
msgid "Last name"
msgstr "Cognome"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname2
msgid "Second last name"
msgstr "Secondo cognome"

View file

@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_employee_lastnames
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2022-09-26 16:07+0000\n"
"Last-Translator: Douglas Custódio <douglascstd@yahoo.com>\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee_base
msgid "Basic Employee"
msgstr "Funcionário Basico"
#. module: hr_employee_lastnames
#: model:ir.model,name:hr_employee_lastnames.model_hr_employee
msgid "Employee"
msgstr "Funcionário"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__firstname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__firstname
msgid "First name"
msgstr "Nome"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname
msgid "Last name"
msgstr "Sobrenome"
#. module: hr_employee_lastnames
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_base__lastname2
#: model:ir.model.fields,field_description:hr_employee_lastnames.field_hr_employee_public__lastname2
msgid "Second last name"
msgstr "Segundo sobrenome"
#~ msgid "Display Name"
#~ msgstr "Nome de Exibição"
#~ msgid "ID"
#~ msgstr "ID"
#~ msgid "Last Modified on"
#~ msgstr "Última Modificação em"

View file

@ -0,0 +1,2 @@
from . import hr_employee_base
from . import hr_employee

View file

@ -0,0 +1,160 @@
import logging
from odoo import api, models
from odoo.addons.hr_employee_firstname.models.hr_employee import UPDATE_PARTNER_FIELDS
_logger = logging.getLogger(__name__)
UPDATE_PARTNER_FIELDS += ["lastname2"]
class HrEmployee(models.Model):
_inherit = "hr.employee"
@api.model
def _get_name_lastnames(self, lastname, firstname, lastname2=None):
order = self._get_names_order()
names = list()
if order == "first_last":
if firstname:
names.append(firstname)
if lastname:
names.append(lastname)
if lastname2:
names.append(lastname2)
else:
if lastname:
names.append(lastname)
if lastname2:
names.append(lastname2)
if names and firstname and order == "last_first_comma":
names[-1] = names[-1] + ","
if firstname:
names.append(firstname)
return " ".join(names)
def _prepare_vals_on_create_firstname_lastname(self, vals):
values = vals.copy()
res = super()._prepare_vals_on_create_firstname_lastname(values)
if any([field in vals for field in ("firstname", "lastname", "lastname2")]):
vals["name"] = self._get_name_lastnames(
vals.get("lastname"), vals.get("firstname"), vals.get("lastname2")
)
elif vals.get("name"):
name_splitted = self.split_name(vals["name"])
vals["firstname"] = name_splitted["firstname"]
vals["lastname"] = name_splitted["lastname"]
vals["lastname2"] = name_splitted["lastname2"]
return res
def _prepare_vals_on_write_firstname_lastname(self, vals):
values = vals.copy()
res = super()._prepare_vals_on_write_firstname_lastname(values)
if any([field in vals for field in ("firstname", "lastname", "lastname2")]):
if "lastname" in vals:
lastname = vals["lastname"]
else:
lastname = self.lastname
if "firstname" in vals:
firstname = vals["firstname"]
else:
firstname = self.firstname
if "lastname2" in vals:
lastname2 = vals["lastname2"]
else:
lastname2 = self.lastname2
vals["name"] = self._get_name_lastnames(lastname, firstname, lastname2)
elif vals.get("name"):
name_splitted = self.split_name(vals["name"])
vals["lastname"] = name_splitted["lastname"]
vals["firstname"] = name_splitted["firstname"]
vals["lastname2"] = name_splitted["lastname2"]
return res
def _update_partner_firstname(self):
for employee in self:
partners = employee.mapped("user_id.partner_id")
partners |= employee.mapped("address_home_id")
partners.write(
{
"firstname": employee.firstname,
"lastname": employee.lastname,
"lastname2": employee.lastname2,
}
)
@api.model
def _get_inverse_name(self, name):
"""Compute the inverted name."""
result = {
"firstname": False,
"lastname": name or False,
"lastname2": False,
}
if not name:
return result
order = self._get_names_order()
result.update(super()._get_inverse_name(name))
if order in ("first_last", "last_first_comma"):
parts = self._split_part("lastname", result)
if parts:
result.update({"lastname": parts[0], "lastname2": " ".join(parts[1:])})
else:
parts = self._split_part("firstname", result)
if parts:
result.update(
{"firstname": parts[-1], "lastname2": " ".join(parts[:-1])}
)
return result
def _split_part(self, name_part, name_split):
"""Split a given part of a name.
:param name_split: The parts of the name
:type dict
:param name_part: The part to split
:type str
"""
name = name_split.get(name_part, False)
parts = name.split(" ", 1) if name else []
if not name or len(parts) < 2:
return False
return parts
def _inverse_name(self):
"""Try to revert the effect of :method:`._compute_name`."""
for record in self:
parts = self._get_inverse_name(record.name)
record.write(
{
"lastname": parts["lastname"],
"firstname": parts["firstname"],
"lastname2": parts["lastname2"],
}
)
@api.model
def _install_employee_lastnames(self):
"""Save names correctly in the database.
Before installing the module, field ``name`` contains all full names.
When installing it, this method parses those names and saves them
correctly into the database. This can be called later too if needed.
"""
# Find records with empty firstname and lastnames
records = self.search([("firstname", "=", False), ("lastname", "=", False)])
# Force calculations there
records._inverse_name()
_logger.info("%d employees updated installing module.", len(records))
@api.onchange("firstname", "lastname", "lastname2")
def _onchange_firstname_lastname(self):
if self.firstname or self.lastname or self.lastname2:
self.name = self._get_name_lastnames(
self.lastname, self.firstname, self.lastname2
)

View file

@ -0,0 +1,9 @@
from odoo import fields, models
class HrEmployeeBase(models.AbstractModel):
_inherit = "hr.employee.base"
firstname = fields.Char("First name")
lastname = fields.Char("Last name")
lastname2 = fields.Char("Second last name")

View file

@ -0,0 +1,2 @@
* Luis Escobar <lescobar@vauxoo.com>
* Hugo Adan <hugo@vauxoo.com>

View file

@ -0,0 +1,2 @@
This module allows you to add firstname and lastnames (Father an Mother Last Name) in employee form,
and concatenate both in name field.

View file

@ -0,0 +1,2 @@
#. Go to *Employees*
#. On the employee form view you will have 3 separate fields, one for Firstname, second for Lastname, both required and Mother's Last Name (optional).

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

@ -0,0 +1,433 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>HR Employee First Name and Two Last Names</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="hr-employee-first-name-and-two-last-names">
<h1 class="title">HR Employee First Name and Two Last Names</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e3ad9ca8445db84cea2f6b86336a239e2277e208c08820c7e4ea30ad9d259fe8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/hr/tree/16.0/hr_employee_lastnames"><img alt="OCA/hr" src="https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-16-0/hr-16-0-hr_employee_lastnames"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/hr&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to add firstname and lastnames (Father an Mother Last Name) in employee form,
and concatenate both in name field.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<ol class="arabic simple">
<li>Go to <em>Employees</em></li>
<li>On the employee form view you will have 3 separate fields, one for Firstname, second for Lastname, both required and Mothers Last Name (optional).</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/hr/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/hr/issues/new?body=module:%20hr_employee_lastnames%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<ul class="simple">
<li>Vauxoo</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<li>Luis Escobar &lt;<a class="reference external" href="mailto:lescobar&#64;vauxoo.com">lescobar&#64;vauxoo.com</a>&gt;</li>
<li>Hugo Adan &lt;<a class="reference external" href="mailto:hugo&#64;vauxoo.com">hugo&#64;vauxoo.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/luisg123v"><img alt="luisg123v" src="https://github.com/luisg123v.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/hr/tree/16.0/hr_employee_lastnames">OCA/hr</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,3 @@
# Copyright (C) 2014 Savoir-faire Linux. All Rights Reserved.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_hr_employee_lastnames

View file

@ -0,0 +1,163 @@
from odoo import exceptions
from odoo.tests.common import TransactionCase
class TestEmployeeLastnames(TransactionCase):
def setUp(self):
super().setUp()
self.env["ir.config_parameter"].sudo().set_param(
"employee_names_order", "first_last"
)
self.employee_model = self.env["hr.employee"]
# Create 3 employees to concatenate the firstname and lastnames
# in name_related
self.employee1_id = self.employee_model.create(
{"firstname": "Manuel", "lastname": "Fernandez", "lastname2": "Gonzalez"}
)
self.employee2_id = self.employee_model.create(
{"firstname": "Jean-Pierre", "lastname": "Carnaud"}
)
self.employee3_id = self.employee_model.create(
{"firstname": "Jenssens", "lastname": "Famke"}
)
# Create 3 employees for split the name_related to
# firstname and lastnames
self.employee10_id = self.employee_model.create(
{"name": "Manuel Fernandez Gonzalez"}
)
self.employee20_id = self.employee_model.create({"name": "Jean-Pierre Carnaud"})
self.employee30_id = self.employee_model.create({"name": "JenssensFamke"})
def test_get_name_lastnames(self):
"""Validate the _get_name_lastnames method is concatenating
the firstname and lastnames
"""
# Check for employee1
self.assertEqual(self.employee1_id.name, "Manuel Fernandez Gonzalez")
# Check for employee2
self.assertEqual(self.employee2_id.name, "Jean-Pierre Carnaud")
# Check for employee3
self.assertEqual(self.employee3_id.name, "Jenssens Famke")
def test_onchange(self):
"""Validate the _get_name_lastnames method is not failing"""
field_onchange = self.employee_model.new({})._onchange_spec()
self.assertEqual(field_onchange.get("firstname"), "1")
self.assertEqual(field_onchange.get("lastname"), "1")
values = {
"firstname": "Pedro",
"lastname": "Perez",
"lastname2": "Hernandez",
"name": "test employee",
}
for field in self.employee_model._fields:
if field not in values:
values[field] = False
# we work on a temporary record
new_record = self.employee_model.new(values)
updates = new_record.onchange(
values, ["firstname", "lastname", "lastname2"], field_onchange
)
values.update(updates.get("value", {}))
self.assertEqual(values["name"], "Pedro Perez Hernandez")
def test_auto_init_name(self):
"""Validate the create method if the name is split
in firstname and lastnames
"""
# Check for employee10
self.assertEqual(self.employee10_id.firstname, "Manuel")
self.assertEqual(self.employee10_id.lastname, "Fernandez")
self.assertEqual(self.employee10_id.lastname2, "Gonzalez")
# Check for employee20
self.assertEqual(self.employee20_id.firstname, "Jean-Pierre")
self.assertEqual(self.employee20_id.lastname, "Carnaud")
self.assertEqual(self.employee20_id.lastname2, False)
# Check for employee30
self.assertEqual(self.employee30_id.firstname, False)
self.assertEqual(self.employee30_id.lastname, "JenssensFamke")
self.assertEqual(self.employee30_id.lastname2, False)
employee_without_name = self.employee_model
with self.assertRaises(exceptions.ValidationError):
employee_without_name = self.employee_model.create(
{"firstname": "", "lastname": ""}
)
self.assertEqual(employee_without_name, self.employee_model)
def test_change_name(self):
self.employee1_id.write({"name": "Pedro Martinez Torres"})
self.employee1_id.invalidate_recordset()
self.assertEqual(self.employee1_id.firstname, "Pedro")
self.assertEqual(self.employee1_id.lastname, "Martinez")
self.assertEqual(self.employee1_id.lastname2, "Torres")
def test_change_name_with_space(self):
self.employee1_id.write({"name": " Jean-Pierre Carnaud-Eyck"})
self.employee1_id.invalidate_recordset()
self.assertEqual(self.employee1_id.firstname, "Jean-Pierre")
self.assertEqual(self.employee1_id.lastname, "Carnaud-Eyck")
self.assertEqual(self.employee1_id.lastname2, False)
def test_change_firstname(self):
self.employee1_id.write({"firstname": "Pedro"})
self.employee1_id.invalidate_recordset()
self.assertEqual(self.employee1_id.name, "Pedro Fernandez Gonzalez")
def test_change_lastname(self):
self.employee1_id.write({"lastname": "Lopez"})
self.employee1_id.invalidate_recordset()
self.assertEqual(self.employee1_id.name, "Manuel Lopez Gonzalez")
def test_change_firstname_and_lastnames(self):
self.employee1_id.write({"firstname": "Jean-Pierre", "lastname2": "Carnaud"})
self.employee1_id.invalidate_recordset()
self.assertEqual(self.employee1_id.name, "Jean-Pierre Fernandez Carnaud")
def test_change_lastname_with_set_last_first(self):
self.env["ir.config_parameter"].sudo().set_param(
"employee_names_order", "last_first"
)
self.employee1_id.write({"lastname": "Lopez"})
self.employee1_id.invalidate_recordset()
self.assertEqual(self.employee1_id.name, "Lopez Gonzalez Manuel")
def test_change_name_with_set_last_first(self):
self.env["ir.config_parameter"].sudo().set_param(
"employee_names_order", "last_first"
)
self.employee1_id.write({"name": "Martinez Torres Pedro"})
self.employee1_id.invalidate_recordset()
self.assertEqual(self.employee1_id.firstname, "Pedro")
self.assertEqual(self.employee1_id.lastname, "Martinez")
self.assertEqual(self.employee1_id.lastname2, "Torres")
self.employee1_id.write({"name": ""})
self.employee1_id.invalidate_recordset()
self.assertEqual(self.employee1_id.firstname, "Pedro")
self.assertEqual(self.employee1_id.lastname, "Martinez")
self.assertEqual(self.employee1_id.lastname2, "Torres")
def test_change_lastname_with_set_last_first_comma(self):
self.env["ir.config_parameter"].sudo().set_param(
"employee_names_order", "last_first_comma"
)
self.employee1_id.write({"lastname": "Lopez"})
self.employee1_id.invalidate_recordset()
self.assertEqual(self.employee1_id.name, "Lopez Gonzalez, Manuel")

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_employee_form_inherit" model="ir.ui.view">
<field name="name">hr.employee.form.firstname.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr_employee_firstname.view_employee_form" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='lastname']" position="after">
<field name="lastname2" />
</xpath>
</data>
</field>
</record>
</odoo>

View file

@ -0,0 +1,42 @@
[project]
name = "odoo-bringout-oca-hr-hr_employee_lastnames"
version = "16.0.0"
description = "HR Employee First Name and Two Last Names - Split Name in First Name, Father's Last Name and Mother's Last Name"
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-hr-hr_employee_firstname>=16.0.0",
"requests>=2.25.1"
]
readme = "README.md"
requires-python = ">= 3.11"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business",
]
[project.urls]
homepage = "https://github.com/bringout/0"
repository = "https://github.com/bringout/0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["hr_employee_lastnames"]
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.4.1",
]