Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
97 changes: 97 additions & 0 deletions payroll_hr_public_holidays/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
=======================
Payroll Public Holidays
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9626246040af3f079fa4b82d4fe5555b571b289ddc26a4240d78d40b3fac75c3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fpayroll-lightgray.png?logo=github
:target: https://github.com/OCA/payroll/tree/18.0/payroll_hr_public_holidays
:alt: OCA/payroll
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/payroll-18-0/payroll-18-0-payroll_hr_public_holidays
: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/payroll&target_branch=18.0
:alt: Try me on Runboat

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

Allows to link hr_holidays_public module with payroll.

With this module installed, public holidats will automatically be
fetched and displayed in worked days table for payslip computation. This
is useful to countries that need to make salary rules with public
holidays data.

**Table of contents**

.. contents::
:local:

Usage
=====

- Set public holidays in holidays module
- Create a payslip
- Public holidays will be fetched automatically to the worked days table

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/payroll/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/payroll/issues/new?body=module:%20payroll_hr_public_holidays%0Aversion:%2018.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
-------

* Nimarosa

Contributors
------------

- Nimarosa (Nicolas Rodriguez) <[email protected]>
- ``Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>``\ \_

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-nimarosa| image:: https://github.com/nimarosa.png?size=40px
:target: https://github.com/nimarosa
:alt: nimarosa

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-nimarosa|

This module is part of the `OCA/payroll <https://github.com/OCA/payroll/tree/18.0/payroll_hr_public_holidays>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions payroll_hr_public_holidays/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (C) 2021 Nimarosa (Nicolas Rodriguez) (<[email protected]>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
16 changes: 16 additions & 0 deletions payroll_hr_public_holidays/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (C) 2021 Nimarosa (Nicolas Rodriguez) (<[email protected]>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Payroll Public Holidays",
"version": "18.0.1.0.0",
"category": "Payroll",
"website": "https://github.com/OCA/payroll",
"summary": "Integration between payroll and hr_public_holidays",
"license": "AGPL-3",
"author": "Nimarosa, Odoo Community Association (OCA)",
"depends": ["payroll", "hr_holidays", "calendar_public_holiday"],
"data": [],
"installable": True,
"maintainers": ["nimarosa"],
}
43 changes: 43 additions & 0 deletions payroll_hr_public_holidays/i18n/es_AR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * payroll_hr_public_holidays
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2022-10-24 23:44+0000\n"
"Last-Translator: Nicolas Rodriguez Sande <[email protected]>\n"
"Language-Team: none\n"
"Language: es_AR\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: payroll_hr_public_holidays
#: model:ir.model.fields,field_description:payroll_hr_public_holidays.field_hr_payslip__display_name
msgid "Display Name"
msgstr "Nombre para mostrar"

#. module: payroll_hr_public_holidays
#: model:ir.model.fields,field_description:payroll_hr_public_holidays.field_hr_payslip__id
msgid "ID"
msgstr "ID"

#. module: payroll_hr_public_holidays
#: model:ir.model.fields,field_description:payroll_hr_public_holidays.field_hr_payslip____last_update
msgid "Last Modified on"
msgstr "Última modificación en"

#. module: payroll_hr_public_holidays
#: model:ir.model,name:payroll_hr_public_holidays.model_hr_payslip
msgid "Payslip"
msgstr "Liquidacion"

#. module: payroll_hr_public_holidays
#: code:addons/payroll_hr_public_holidays/models/hr_payslip.py:0
#, python-format
msgid "Public Holidays Leaves"
msgstr "Ausencias por feriados"
43 changes: 43 additions & 0 deletions payroll_hr_public_holidays/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * payroll_hr_public_holidays
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-01-05 19:06+0000\n"
"Last-Translator: mymage <[email protected]>\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 5.6.2\n"

#. module: payroll_hr_public_holidays
#: model:ir.model.fields,field_description:payroll_hr_public_holidays.field_hr_payslip__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: payroll_hr_public_holidays
#: model:ir.model.fields,field_description:payroll_hr_public_holidays.field_hr_payslip__id
msgid "ID"
msgstr "ID"

#. module: payroll_hr_public_holidays
#: model:ir.model.fields,field_description:payroll_hr_public_holidays.field_hr_payslip____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: payroll_hr_public_holidays
#: model:ir.model,name:payroll_hr_public_holidays.model_hr_payslip
msgid "Payslip"
msgstr "Busta paga"

#. module: payroll_hr_public_holidays
#: code:addons/payroll_hr_public_holidays/models/hr_payslip.py:0
#, python-format
msgid "Public Holidays Leaves"
msgstr "Festività nazionali"
26 changes: 26 additions & 0 deletions payroll_hr_public_holidays/i18n/payroll_hr_public_holidays.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * payroll_hr_public_holidays
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.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: payroll_hr_public_holidays
#: model:ir.model,name:payroll_hr_public_holidays.model_hr_payslip
msgid "Payslip"
msgstr ""

#. module: payroll_hr_public_holidays
#. odoo-python
#: code:addons/payroll_hr_public_holidays/models/hr_payslip.py:0
#, python-format
msgid "Public Holidays Leaves"
msgstr ""
43 changes: 43 additions & 0 deletions payroll_hr_public_holidays/i18n/pt.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * payroll_hr_public_holidays
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-01-07 17:01+0000\n"
"Last-Translator: Pedro Castro Silva <[email protected]>\n"
"Language-Team: none\n"
"Language: pt\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: payroll_hr_public_holidays
#: model:ir.model.fields,field_description:payroll_hr_public_holidays.field_hr_payslip__display_name
msgid "Display Name"
msgstr "Nome a Exibir"

#. module: payroll_hr_public_holidays
#: model:ir.model.fields,field_description:payroll_hr_public_holidays.field_hr_payslip__id
msgid "ID"
msgstr ""

#. module: payroll_hr_public_holidays
#: model:ir.model.fields,field_description:payroll_hr_public_holidays.field_hr_payslip____last_update
msgid "Last Modified on"
msgstr "Última Modificação em"

#. module: payroll_hr_public_holidays
#: model:ir.model,name:payroll_hr_public_holidays.model_hr_payslip
msgid "Payslip"
msgstr "Recibo de Vencimento"

#. module: payroll_hr_public_holidays
#: code:addons/payroll_hr_public_holidays/models/hr_payslip.py:0
#, python-format
msgid "Public Holidays Leaves"
msgstr "Ausências em Feriados Públicos"
27 changes: 27 additions & 0 deletions payroll_hr_public_holidays/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * payroll_hr_public_holidays
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\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"

#. module: payroll_hr_public_holidays
#: model:ir.model,name:payroll_hr_public_holidays.model_hr_payslip
msgid "Payslip"
msgstr ""

#. module: payroll_hr_public_holidays
#. odoo-python
#: code:addons/payroll_hr_public_holidays/models/hr_payslip.py:0
#, python-format
msgid "Public Holidays Leaves"
msgstr ""
4 changes: 4 additions & 0 deletions payroll_hr_public_holidays/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (C) 2021 Nimarosa (Nicolas Rodriguez) (<[email protected]>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import hr_payslip
47 changes: 47 additions & 0 deletions payroll_hr_public_holidays/models/hr_payslip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright (C) 2021 Nimarosa (Nicolas Rodriguez) (<[email protected]>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from odoo import _, api, models


class HrPayslip(models.Model):
_inherit = "hr.payslip"

@api.model
def get_worked_day_lines(self, contracts, date_from, date_to):
res = super().get_worked_day_lines(contracts, date_from, date_to)
for contract in contracts.filtered(
lambda contract: contract.resource_calendar_id
):
# only use payslip day_from if it's greather than contract start date
if date_from < contract.date_start:
date_from = contract.date_start
# == compute public holidays == #
pholidays = self._compute_public_holidays_days(contract, date_from, date_to)
if pholidays["number_of_days"] > 0:
res.append(pholidays)
return res

def _compute_public_holidays_days(self, contract, date_from, date_to):
# get public holidays list
public_holidays = self.env["calendar.public.holiday"].get_holidays_list(
year=date_from.year,
start_dt=date_from,
end_dt=date_to,
partner_id=contract.employee_id.message_partner_ids.id,
)
ph_days = len(public_holidays)
ph_hours = (
ph_days * 8
) # Use 8 as default value if employee has no resource_calendar
if contract.employee_id.resource_calendar_id:
ph_hours = ph_days * contract.employee_id.resource_calendar_id.hours_per_day
return {
"name": _("Public Holidays Leaves"),
"sequence": 10,
"code": "PHOL",
"number_of_days": ph_days,
"number_of_hours": ph_hours,
"contract_id": contract.id,
}
3 changes: 3 additions & 0 deletions payroll_hr_public_holidays/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 payroll_hr_public_holidays/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Nimarosa (Nicolas Rodriguez) \<<[email protected]>\>
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`_
6 changes: 6 additions & 0 deletions payroll_hr_public_holidays/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Allows to link hr_holidays_public module with payroll.

With this module installed, public holidats will automatically be
fetched and displayed in worked days table for payslip computation. This
is useful to countries that need to make salary rules with public
holidays data.
3 changes: 3 additions & 0 deletions payroll_hr_public_holidays/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Set public holidays in holidays module
- Create a payslip
- Public holidays will be fetched automatically to the worked days table
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading