Skip to content

Commit

Permalink
Merge pull request #18 from hbrunn/15.0-14-hr_attendance_break
Browse files Browse the repository at this point in the history
[ADD] hr_attendance_break
  • Loading branch information
albig authored Sep 28, 2023
2 parents d05877d + b94824e commit 85b1d07
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 5 deletions.
2 changes: 2 additions & 0 deletions repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ hr-attendance:
- oca 15.0
# https://github.com/OCA/hr-attendance/pull/140
- oca refs/pull/140/head
# https://github.com/OCA/hr-attendance/pull/142
- oca refs/pull/142/head
hr-holidays:
remotes:
oca: https://github.com/OCA/hr-holidays.git
Expand Down
3 changes: 3 additions & 0 deletions verdigado_attendance/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"installable": True,
"depends": [
"hr_attendance",
"hr_attendance_autoclose",
"hr_attendance_break",
"hr_attendance_break_autoclose",
"hr_holidays_attendance",
"l10n_de_holidays",
"hr_holidays_public_overtime",
Expand Down
1 change: 1 addition & 0 deletions verdigado_attendance/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import hr_attendance
from . import hr_attendance_break
from . import hr_attendance_report
from . import hr_leave_type
9 changes: 5 additions & 4 deletions verdigado_attendance/models/hr_attendance.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

#
# dummy model to allow verdigado_hr_attendance_rule_attendance_manager rule
#

from odoo import models

from .hr_attendance_break import DatetimeWithoutSeconds


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

check_in = DatetimeWithoutSeconds()
check_out = DatetimeWithoutSeconds()
20 changes: 20 additions & 0 deletions verdigado_attendance/models/hr_attendance_break.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import fields, models


class DatetimeWithoutSeconds(fields.Datetime):
def convert_to_column(self, value, record, values=None, validate=True):
return super().convert_to_column(
value and self.to_datetime(value).replace(second=0) or value,
record,
values=values,
validate=validate,
)


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

begin = DatetimeWithoutSeconds()
end = DatetimeWithoutSeconds()
5 changes: 4 additions & 1 deletion verdigado_attendance/models/hr_attendance_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ class HrAttendanceReport(models.Model):
def _join(self):
"""Add overtime adjustments"""
return super()._join() + " UNION %s %s %s" % (
self._select().replace("hra.worked_hours", "0"),
self._select()
.replace("hra.worked_hours", "0")
.replace("break_hours", "0")
.replace("ot.duration", "0"),
self._from(),
super()._join().replace("ot.adjustment = FALSE", "ot.adjustment = TRUE"),
)
1 change: 1 addition & 0 deletions verdigado_attendance/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

from . import test_hr_access
from . import test_overtime_calculation
from odoo.addons.hr_attendance_break.tests import test_hr_attendance_break

0 comments on commit 85b1d07

Please sign in to comment.