Skip to content

Commit

Permalink
Merge PR #87 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by dreispt
  • Loading branch information
OCA-git-bot committed Nov 18, 2023
2 parents 914a332 + c2094b8 commit dcf6949
Show file tree
Hide file tree
Showing 14 changed files with 628 additions and 0 deletions.
93 changes: 93 additions & 0 deletions hr_holidays_public_overtime/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
=============================
HR Holidays Public (overtime)
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9148557ccb89605827fe77ae5b755d87bfe8378a300e517be0e705dc0cde52fa
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/15.0/hr_holidays_public_overtime
: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-15-0/hr-holidays-15-0-hr_holidays_public_overtime
: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=15.0
:alt: Try me on Runboat

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

This module adds support for public holidays in Odoo's overtime calculation.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

#. Go to Attendances, and record time on a date that is a public holiday for your employee
#. Observe the time recorded is counted as extra hours

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_holidays_public_overtime%0Aversion:%2015.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
~~~~~~~

* Hunki Enterprises BV
* Verdigado eG

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

* Holger Brunn <[email protected]> (https://hunki-enterprises.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-hbrunn| image:: https://github.com/hbrunn.png?size=40px
:target: https://github.com/hbrunn
:alt: hbrunn

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

|maintainer-hbrunn|

This module is part of the `OCA/hr-holidays <https://github.com/OCA/hr-holidays/tree/15.0/hr_holidays_public_overtime>`_ 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_holidays_public_overtime/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions hr_holidays_public_overtime/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 Hunki Enterprises BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)

{
"name": "HR Holidays Public (overtime)",
"summary": "Support public holidays in overtime calculations",
"version": "15.0.1.0.0",
"development_status": "Beta",
"category": "Human Resources",
"website": "https://github.com/OCA/hr-holidays",
"author": "Hunki Enterprises BV, Odoo Community Association (OCA), verdigado eG",
"maintainers": ["hbrunn"],
"license": "AGPL-3",
"depends": [
"hr_holidays_public",
"hr_attendance",
],
"auto_install": True,
}
1 change: 1 addition & 0 deletions hr_holidays_public_overtime/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import hr_attendance
28 changes: 28 additions & 0 deletions hr_holidays_public_overtime/models/hr_attendance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2023 Hunki Enterprises BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)

from collections import defaultdict

from odoo import models


class HrAttendance(models.Model):
_inherit = "hr.attendance"

def _update_overtime(self, employee_attendance_dates=None):
"""Set the flag in context to exclude public holidays"""
if employee_attendance_dates is None:
employee_attendance_dates = self._get_attendances_dates()
# also set the flag on the employees' context as some code paths get dates from there
employee_attendance_dates = defaultdict(
employee_attendance_dates.default_factory,
{
employee.with_context(
exclude_public_holidays=True, employee_id=employee.id
): dates
for employee, dates in employee_attendance_dates.items()
},
)
return super(
HrAttendance, self.with_context(exclude_public_holidays=True)
)._update_overtime(employee_attendance_dates=employee_attendance_dates)
1 change: 1 addition & 0 deletions hr_holidays_public_overtime/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Holger Brunn <[email protected]> (https://hunki-enterprises.com)
1 change: 1 addition & 0 deletions hr_holidays_public_overtime/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds support for public holidays in Odoo's overtime calculation.
4 changes: 4 additions & 0 deletions hr_holidays_public_overtime/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To use this module, you need to:

#. Go to Attendances, and record time on a date that is a public holiday for your employee
#. Observe the time recorded is counted as extra hours
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit dcf6949

Please sign in to comment.