-
Notifications
You must be signed in to change notification settings - Fork 0
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
[IMP] hr_attendance_missing_days: don't break on multi work day attendances #1
[IMP] hr_attendance_missing_days: don't break on multi work day attendances #1
Conversation
@@ -79,6 +79,9 @@ def _create_missing_attendances(self, date_from=None, date_to=None): | |||
attendances = { | |||
ensure_tz(attendance.check_in, tz).date() | |||
for attendance in self.attendance_ids.filtered_domain(domain) | |||
} | { | |||
ensure_tz(attendance.check_out, tz).date() | |||
for attendance in self.attendance_ids.filtered_domain(domain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered enumerating the days between check_in and check_out, but then I couldn't think of a real live case where anyone records 24+ hours
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically it's clean but the entire self.attendance_ids.filtered_domain(domain)
would be executed multiple times. I guess the following could be better (well I'm not fully pleased with the naming)
attendances = self.attendance_ids.filtered_domain(domain)
attendances = attendances.mapped("check_in") + attendances.mapped("check_out")
attendances = {ensure_tz(attendance, tz).date() for attendance in attendances}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, made it so
@@ -79,6 +79,9 @@ def _create_missing_attendances(self, date_from=None, date_to=None): | |||
attendances = { | |||
ensure_tz(attendance.check_in, tz).date() | |||
for attendance in self.attendance_ids.filtered_domain(domain) | |||
} | { | |||
ensure_tz(attendance.check_out, tz).date() | |||
for attendance in self.attendance_ids.filtered_domain(domain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically it's clean but the entire self.attendance_ids.filtered_domain(domain)
would be executed multiple times. I guess the following could be better (well I'm not fully pleased with the naming)
attendances = self.attendance_ids.filtered_domain(domain)
attendances = attendances.mapped("check_in") + attendances.mapped("check_out")
attendances = {ensure_tz(attendance, tz).date() for attendance in attendances}
532f10f
into
initOS:15.0-hr_attendance_missing_days
…dances (#1) * [IMP] hr_attendance_missing_days: don't break on multi work day attendances * [ADD] hr_attendance_contract_missing_days: tests * fixup! [ADD] hr_attendance_contract_missing_days: tests
…dances (#1) * [IMP] hr_attendance_missing_days: don't break on multi work day attendances * [ADD] hr_attendance_contract_missing_days: tests * fixup! [ADD] hr_attendance_contract_missing_days: tests
…dances (#1) * [IMP] hr_attendance_missing_days: don't break on multi work day attendances * [ADD] hr_attendance_contract_missing_days: tests * fixup! [ADD] hr_attendance_contract_missing_days: tests
@fkantelberg thanks again for this. We ran into an issue when an attendance spans multiple days in the work calendar, here my proposed fix plus test case.
While being on it, I took the liberty to add another commit adding a test for
hr_attendance_contract_missing_days
, hoping greenness will trigger the good people of hr-attendance maintainers to merge the PR.