Skip to content

Commit

Permalink
[IMP] hr_employee_lastnames: pre-commit stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
andreagidaltig committed Nov 16, 2023
1 parent 5d878c5 commit 3542976
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 30 deletions.
30 changes: 16 additions & 14 deletions hr_employee_lastnames/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ HR Employee First Name and Two Last Names
: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
:target: https://github.com/OCA/hr/tree/17.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
:target: https://translation.odoo-community.org/projects/hr-17-0/hr-17-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
:target: https://runboat.odoo-community.org/builds?repo=OCA/hr&target_branch=17.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.
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**

Expand All @@ -39,35 +39,37 @@ and concatenate both in name field.
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).
1. Go to *Employees*
2. 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**>`_.
`feedback <https://github.com/OCA/hr/issues/new?body=module:%20hr_employee_lastnames%0Aversion:%2017.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 <[email protected]>
* Hugo Adan <[email protected]>
- Luis Escobar <[email protected]>
- Hugo Adan <[email protected]>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -79,6 +81,6 @@ 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.

This module is part of the `OCA/hr <https://github.com/OCA/hr/tree/16.0/hr_employee_lastnames>`_ project on GitHub.
This module is part of the `OCA/hr <https://github.com/OCA/hr/tree/17.0/hr_employee_lastnames>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 3 additions & 3 deletions hr_employee_lastnames/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _get_name_lastnames(self, lastname, firstname, lastname2=None):

def _prepare_vals_on_create_firstname_lastname(self, vals):
values = vals.copy()
res = super(HrEmployee, self)._prepare_vals_on_create_firstname_lastname(values)
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")
Expand All @@ -50,7 +50,7 @@ def _prepare_vals_on_create_firstname_lastname(self, vals):

def _prepare_vals_on_write_firstname_lastname(self, vals):
values = vals.copy()
res = super(HrEmployee, self)._prepare_vals_on_write_firstname_lastname(values)
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"]
Expand Down Expand Up @@ -97,7 +97,7 @@ def _get_inverse_name(self, name):
return result

order = self._get_names_order()
result.update(super(HrEmployee, self)._get_inverse_name(name))
result.update(super()._get_inverse_name(name))

if order in ("first_last", "last_first_comma"):
parts = self._split_part("lastname", result)
Expand Down
3 changes: 3 additions & 0 deletions hr_employee_lastnames/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions hr_employee_lastnames/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Luis Escobar \<<[email protected]>\>
- Hugo Adan \<<[email protected]>\>
2 changes: 0 additions & 2 deletions hr_employee_lastnames/readme/CONTRIBUTORS.rst

This file was deleted.

2 changes: 2 additions & 0 deletions hr_employee_lastnames/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 0 additions & 2 deletions hr_employee_lastnames/readme/DESCRIPTION.rst

This file was deleted.

4 changes: 4 additions & 0 deletions hr_employee_lastnames/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1. Go to *Employees*
2. 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).
2 changes: 0 additions & 2 deletions hr_employee_lastnames/readme/USAGE.rst

This file was deleted.

14 changes: 8 additions & 6 deletions hr_employee_lastnames/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,9 @@ <h1 class="title">HR Employee First Name and Two Last Names</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e4f0e057a11708fb06d7fb285b5437c765e637981b18e15a0fa1ae34770e1834
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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><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/17.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-17-0/hr-17-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=17.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">
Expand All @@ -389,15 +389,17 @@ <h1 class="title">HR Employee First Name and Two Last Names</h1>
<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 Mother’s Last Name (optional).</li>
<li>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).</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>
<a class="reference external" href="https://github.com/OCA/hr/issues/new?body=module:%20hr_employee_lastnames%0Aversion:%2017.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">
Expand All @@ -422,7 +424,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<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>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>This module is part of the <a class="reference external" href="https://github.com/OCA/hr/tree/17.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>
Expand Down
2 changes: 1 addition & 1 deletion hr_employee_lastnames/tests/test_hr_employee_lastnames.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class TestEmployeeLastnames(TransactionCase):
def setUp(self):
super(TestEmployeeLastnames, self).setUp()
super().setUp()
self.env["ir.config_parameter"].sudo().set_param(
"employee_names_order", "first_last"
)
Expand Down

0 comments on commit 3542976

Please sign in to comment.