feat(fusion_clock): multi-day leave requests (date range)

Request Leave now takes a From/To date range instead of a single day (the To
field is optional -> single-day). Added date_to to fusion.clock.leave.request
(start kept as leave_date), with overlap detection on submit and a date_to >=
leave_date constraint. The absence check and reports now treat a leave as
covering its whole span. The form shows two date inputs; the controller accepts
date_from/date_to (the old single leave_date payload is still honoured). A
migration backfills date_to = leave_date for existing rows.

Live and verified on entech 19.0.3.13.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-30 23:01:19 -04:00
parent 87639a12b5
commit 6a9c7c74ea
10 changed files with 128 additions and 27 deletions

View File

@@ -166,8 +166,9 @@ class FusionClockReport(models.Model):
self.attendance_ids = [(6, 0, attendances.ids)]
leave_domain = [
('leave_date', '>=', self.date_start),
# Any leave whose range overlaps the report period.
('leave_date', '<=', self.date_end),
('date_to', '>=', self.date_start),
]
if self.employee_id:
leave_domain.append(('employee_id', '=', self.employee_id.id))