Skip to content

Commit

Permalink
[ADD] New module hr_leave_type_code
Browse files Browse the repository at this point in the history
  • Loading branch information
aleuffre committed Jul 5, 2023
1 parent 3858cbb commit e74bd83
Show file tree
Hide file tree
Showing 15 changed files with 674 additions and 0 deletions.
87 changes: 87 additions & 0 deletions hr_leave_type_code/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
==================
HR Leave Type Code
==================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:00a5a4fe09bb38183e526c95d2c5b1c104c0ef8128c5569ed2f897b29d9445c5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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--holidays-lightgray.png?logo=github
:target: https://github.com/OCA/hr-holidays/tree/16.0/hr_leave_type_code
:alt: OCA/hr-holidays
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/hr-holidays-16-0/hr-holidays-16-0-hr_leave_type_code
: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-holidays&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds a code field on leave types.

Additionally, the display name of leave types is calculated as "CODE - Name" if the leave type has a code.

**Table of contents**

.. contents::
:local:

Usage
=====

#. Navigate to *Time Off > Configuration > Time Off Types*.
#. Select a leave
#. Add a code

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr-holidays/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-holidays/issues/new?body=module:%20hr_leave_type_code%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
~~~~~~~

* PyTech SRL

Contributors
~~~~~~~~~~~~

* `Pytech SRL <https://www.pytech.it>`__:

* Alessandro Uffreduzzi <[email protected]>

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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions hr_leave_type_code/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions hr_leave_type_code/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "HR Leave Type Code",
"version": "16.0.1.0.0",
"category": "Human Resources",
"summary": "Add a code field to HR Leaves",
"website": "https://github.com/OCA/hr-holidays",
"author": "PyTech SRL, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["hr_holidays"],
"data": [
"views/hr_leave_type.xml",
],
"demo": [],
}
36 changes: 36 additions & 0 deletions hr_leave_type_code/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_leave_type_code
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-05 13:52+0000\n"
"PO-Revision-Date: 2023-07-05 13:52+0000\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_leave_type_code
#: model:ir.model.fields,field_description:hr_leave_type_code.field_hr_leave_type__code
msgid "Code"
msgstr "Codice"

#. module: hr_leave_type_code
#: model:ir.model.fields,field_description:hr_leave_type_code.field_hr_leave_type__smart_search
msgid "Smart Search"
msgstr "Ricerca intelligente"

#. module: hr_leave_type_code
#: model:ir.model.constraint,message:hr_leave_type_code.constraint_hr_leave_type_code_uniq
msgid "The code must be unique per company!"
msgstr "Il codice deve essere univoco per azienda."

#. module: hr_leave_type_code
#: model:ir.model,name:hr_leave_type_code.model_hr_leave_type
msgid "Time Off Type"
msgstr "Tipologia ferie"
1 change: 1 addition & 0 deletions hr_leave_type_code/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import hr_leave_type
26 changes: 26 additions & 0 deletions hr_leave_type_code/models/hr_leave_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from odoo import fields, models


class HolidaysType(models.Model):
_inherit = "hr.leave.type"

code = fields.Char()

def name_get(self):
if self.requested_name_get():
return super().name_get()

return [
(record.id, f"{record.code} - {record.name}")
if record.code
else (record.id, f"{record.name}")
for record in self
]

_sql_constraints = [
(
"code_uniq",
"UNIQUE(code, company_id)",
"The code must be unique per company!",
)
]
3 changes: 3 additions & 0 deletions hr_leave_type_code/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Pytech SRL <https://www.pytech.it>`__:

* Alessandro Uffreduzzi <[email protected]>
3 changes: 3 additions & 0 deletions hr_leave_type_code/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module adds a code field on leave types.

Additionally, the display name of leave types is calculated as "CODE - Name" if the leave type has a code.
3 changes: 3 additions & 0 deletions hr_leave_type_code/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#. Navigate to *Time Off > Configuration > Time Off Types*.
#. Select a leave
#. Add a code
Loading

0 comments on commit e74bd83

Please sign in to comment.