Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD][16.0] New module hr_leave_type_code #82

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()

Check warning on line 11 in hr_leave_type_code/models/hr_leave_type.py

View check run for this annotation

Codecov / codecov/patch

hr_leave_type_code/models/hr_leave_type.py#L11

Added line #L11 was not covered by tests

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
Loading