feat(fusion_clock): native recurring shifts engine [A4-A5]

fusion.clock.schedule.recurrence (repeat every N day/week/month/year;
forever/until/N-times) re-fit from planning.recurrency onto per-day rows;
daily generation cron; _fclk_on_leave skip; planner Repeat…/Stop-repeat
UI + endpoints; recurrence + role indicators on cells.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-06-04 20:49:26 -04:00
parent b4ca85e291
commit 734b3b94fd
12 changed files with 591 additions and 0 deletions

View File

@@ -173,6 +173,19 @@ class HrEmployee(models.Model):
('schedule_date', '=', date_obj),
], limit=1)
def _fclk_on_leave(self, date):
"""True if an approved leave request covers ``date`` for this employee.
Used by the recurrence engine to skip generating shifts on days off."""
self.ensure_one()
date_obj = fields.Date.to_date(date)
if not date_obj:
return False
return bool(self.env['fusion.clock.leave.request'].sudo().search_count([
('employee_id', '=', self.id),
('leave_date', '<=', date_obj),
('date_to', '>=', date_obj),
]))
def _get_fclk_day_plan(self, date):
"""Return the effective plan for a local date, with an explicit
``scheduled`` flag that ALL attendance automation keys off.