dodil/erp-brick-time-off
DODIL ERP brick: time off
src/brick_time_off/domain/values.py
"""The settings a customer edits (dated rows in tof_settings), their defaults, and what every company starts with.
Code never knows a country: public holidays, the work pattern and the manager come from hr; the business date is counted in
`business_timezone`."""
# key -> (default, what it changes). Slice A reads allow_negative_days, max_days_ahead, min_booking, leaver_cancel_future and
# business_timezone; the rest of the spec's config_rows arrive with their stories. business_timezone is not in the spec's
# config_rows (spec gap): it is named by the invariant "the business date is in business_timezone".
SETTING_DEFS = {
"allow_negative_days": ("0", "how far below zero a balance may go; tof:settings:controls"),
"carry_over_max_days": ("5", "the most days carried into the next leave year; tof:settings:controls"),
"carry_over_expires": ("03-31", "the day carried days expire in the new leave year"),
"max_days_ahead": ("365", "how far ahead a request may start"),
"min_booking": ("half_day", "half_day | full_day | hour"),
"overlap_threshold_pct": ("40", "the share of a team off on one day above which approval warns"),
"overlap_mode": ("warn", "warn | block; tof:settings:controls"),
"fit_note_after_days": ("7", "calendar days of sickness after which a fit note is asked"),
"approval_reminder_days": ("2", "business days before an approver is reminded"),
"manager_records_sickness": ("true", "managers may record sickness for their team; tof:settings:controls"),
"leaver_cancel_future": ("true", "a leaver's approved leave after the last day is cancelled automatically"),
"business_timezone": ("Europe/London", "the zone 'today' is counted in; tof:settings:controls"),
}
# The leave types every company starts with (company_code "*" = all companies; a company's own row of the same code wins):
# (code, name, pay_treatment, recorded_or_requested, counts_against, evidence_rule, max_days_per_year). TOF-11.
DEFAULT_LEAVE_TYPES = (
("ANNUAL", "Annual leave", "paid", "requested", "ANNUAL", "none", None),
("UNPAID", "Unpaid leave", "unpaid", "requested", "none", "none", None),
("COMPASSIONATE", "Compassionate leave", "paid", "requested", "none", "none", 5),
("TOIL", "Time off in lieu", "paid", "requested", "none", "none", None),
("SICK", "Sickness", "sick", "recorded", "none", "fit_note", None),
("MATERNITY", "Maternity leave", "statutory_maternity", "recorded", "none", "matb1", None),
("PATERNITY", "Paternity leave", "statutory_paternity", "recorded", "none", "none", None),
("ADOPTION", "Adoption leave", "statutory_adoption", "recorded", "none", "none", None),
("SHARED_PARENTAL", "Shared parental leave", "statutory_shared_parental", "recorded", "none", "none", None),
)
# The annual-leave policies every company starts with (company "*"): 25 days plus the bank holidays of where the person works.
# Full-time people book in DAYS (bank holidays on top, never deducted); anyone below FTE 1.0 books in HOURS with the bank holidays
# inside the allowance (prorated by FTE), each one that falls on a day they work deducted (TOF-06).
# (code, leave_type, unit, annual_days, bank_holidays, rounding, applies_to_json)
DEFAULT_POLICIES = (
("UK-ANNUAL", "ANNUAL", "days", "25", "on_top", "half_day_up", '{"fte_min": "1.0000"}'),
("UK-ANNUAL-PT", "ANNUAL", "hours", "25", "included", "none", '{"fte_below": "1.0000"}'),
)