[IMP] hr-luncheon-voucher: add effective attendance as criteria

The calculation of eligible attendances now also depends on the
effective attendance period field.
This commit is contained in:
Stéphan Sainléger
2023-01-18 15:16:05 +01:00
parent 2a6fb40a15
commit eab094677a
3 changed files with 8 additions and 2 deletions

View File

@@ -7,7 +7,11 @@ class ResourceCalendar(models.Model):
_inherit = "resource.calendar"
def _retrieve_day_matching_attendances(self, day):
domain = [("calendar_id", "=", self.id),("dayofweek", "=", day.weekday())]
domain = [
("calendar_id", "=", self.id),
("dayofweek", "=", day.weekday()),
("effective_attendance_period", "=", True)
]
if self.two_weeks_calendar:
# Employee has Even/Odd weekly calendar
week_type = 1 if int(math.floor((day.toordinal() - 1) / 7) % 2) else 0