Files
Odoo-Modules/fusion_clock/migrations/19.0.3.13.0/post-migrate.py
gsinghpal 6a9c7c74ea 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>
2026-05-30 23:01:19 -04:00

18 lines
564 B
Python

# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
"""Backfill leave-request end dates on upgrade to 19.0.3.13.0.
Leave requests gained a `date_to` (end of a multi-day range). Existing
single-day requests have no end date; set it to the start date so they keep
being treated as one-day leaves by the absence check and reports.
"""
def migrate(cr, version):
if not version:
return
cr.execute(
"UPDATE fusion_clock_leave_request SET date_to = leave_date WHERE date_to IS NULL"
)