Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] hr_attendance_missing_days: Migration to 16.0 #160

Closed
Closed
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
[IMP] hr_attendance_missing_days: Use hr.contract for the generation …
…of the missing days
fkantelberg authored and Highcooley committed Jan 23, 2024
commit 850d1601d0c930cfe2512a119f2e71287e8c8e95
8 changes: 6 additions & 2 deletions hr_attendance_missing_days/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -29,6 +29,10 @@ def _prepare_missing_attendance_values(self, dt, reasons):
"attendance_reason_ids": [(6, 0, reasons.ids)],
}

def _get_work_intervals_batch(self, dt_from, dt_to):
self.ensure_one()
return self.resource_calendar_id._work_intervals_batch(dt_from, dt_to)[False]

def create_missing_attendances(self, date_from=None, date_to=None):
for emp in self.search([]):
emp._create_missing_attendances(date_from, date_to)
@@ -61,9 +65,9 @@ def _create_missing_attendances(self, date_from=None, date_to=None):
if dt_from > dt_to:
return

intervals = self.resource_calendar_id._work_intervals_batch(dt_from, dt_to)
intervals = self._get_work_intervals_batch(dt_from, dt_to)
work_dates = {}
for start, _stop, _attendance in sorted(intervals[False]):
for start, _stop, _attendance in sorted(intervals):
start_date = start.date()
if start_date not in work_dates:
work_dates[start_date] = ensure_tz(start, pytz.utc).replace(tzinfo=None)
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
<div class="o_setting_left_pane" />
<div class="o_setting_right_pane">
<label
string="Autoclose Reason"
string="Reason"
for="attendance_missing_days_reason"
/>
<span