-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] cut off seconds for attendances and breaks
- Loading branch information
Showing
4 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters