-
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.
Merge pull request #73 from kmee/16.0-overtime
16.0 overtime
- Loading branch information
Showing
15 changed files
with
637 additions
and
200 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
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
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,3 +1,4 @@ | ||
from . import hr_attendance | ||
from . import res_config_settings | ||
from . import hr_attendance_overtime | ||
from . import hr_overtime_multiplier_range | ||
from . import hr_attendance_exception |
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
42 changes: 42 additions & 0 deletions
42
l10n_br_hr_overtime_custom_multiplier/models/hr_attendance_exception.py
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,42 @@ | ||
# Copyright 2024 KMEE | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import _, api, fields, models | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
class HrAttendanceException(models.Model): | ||
_name = "hr.attendance.exception" | ||
_description = "Attendance Exception" | ||
|
||
employee_id = fields.Many2one("hr.employee", string="Employee", required=True) | ||
date = fields.Date(required=True) | ||
day_of_week_override = fields.Selection( | ||
[ | ||
("monday", "Monday"), | ||
("tuesday", "Tuesday"), | ||
("wednesday", "Wednesday"), | ||
("thursday", "Thursday"), | ||
("friday", "Friday"), | ||
("saturday", "Saturday"), | ||
("sunday", "Sunday"), | ||
("holiday", "Holiday"), | ||
], | ||
string="Override Day of the Week", | ||
required=True, | ||
) | ||
|
||
@api.constrains("employee_id", "date") | ||
def _check_duplicate_exception(self): | ||
for record in self: | ||
duplicate_exception = self.search( | ||
[ | ||
("employee_id", "=", record.employee_id.id), | ||
("date", "=", record.date), | ||
("id", "!=", record.id), | ||
] | ||
) | ||
if duplicate_exception: | ||
raise ValidationError( | ||
_("An exception already exists for this employee on this date.") | ||
) |
Oops, something went wrong.