Attendance and shift management
Attendance and shift management records when employees are expected to work, when they actually work, and how approved exceptions affect that record. It connects shift plans and employee check-ins to daily attendance, overtime pay, and compensatory leave. See Workforce management, Employee lifecycle, Leave management, Recruitment and staffing, Performance, skills, and learning, and Employee expenses and travel for related domains.
Working-time model
The working-time model separates expected work from observed time and from the final daily result. Shift definitions and dated assignments provide the expected work window. Check-ins provide time events. Attendance provides the submitted business result.
Shift definitions
A shift defines the expected working window for an employee. A Shift Type sets the start and end time, the holiday list, the rules for matching check-ins, the way working hours are measured, and the thresholds for Present, Half Day, or Absent. It can also allow overtime and mark late entry or early exit. The shift model supports overnight work by treating an end time earlier than the start time as the next day.
The shift window must remain shorter than one day after its early check-in and late check-out buffers are included. A shift with no absent buffer can close attendance on the same day only when automatic last-sync updates are enabled. Changes to a shift start time are blocked while unprocessed check-ins still use that shift.
The shift also defines a check-in window around the expected time. This window can accept an early check-in or a late check-out without changing the planned shift. An optional Shift Location adds a geographic boundary to a shift assignment. When location tracking is enabled, a check-in must fall within that boundary before it is accepted.
References: hrms/…/shift_type.json• L40-225 hrms/…/shift_type.py• L83-163 hrms/…/shift_location.json• L20-70
Shift assignments
A Shift Assignment connects an employee to a Shift Type for a date range. It is the main source for deciding which shift applies to an employee on a given date. An assignment can also carry a shift location and an overtime type.
Active assignments must not create an invalid overlap for the employee. The system checks both date overlap and shift-time overlap. If HR settings allow multiple assignments on one date, the date overlap can produce a warning, but overlapping shift times remain invalid. If no assignment applies, attendance-related lookup can use the employee’s default shift when that fallback is requested.
An assignment cannot be cancelled after it is linked to employee check-ins or attendance. This protects the links that explain how a time event became a daily result.
Shift requests provide an approval path for a proposed employee shift and date range. Processing an approved request creates the assignment that attendance and check-in processing later use. A Shift Assignment Tool also supports assigning one shift or one schedule to selected employees and processing matching shift requests in bulk.
References: hrms/…/shift_assignment.json• L29-147 hrms/…/shift_assignment_tool.json• L39-208 hrms/…/shift_request.py• L41-95
Shift schedules
A Shift Schedule describes a repeating pattern for one Shift Type. It combines a weekly interval with selected days. A Shift Schedule Assignment connects that pattern to an employee and can keep creating dated Shift Assignments from a start point.
This separates the recurring plan from the dated records used by attendance. A schedule assignment may be active for ongoing creation or limited to a known period. Each generated assignment keeps the schedule link, so the source of the employee’s recurring shift remains visible. The system does not move the creation point backward over assignments that already exist.
References: hrms/…/shift_schedule.json• L18-69 hrms/…/shift_schedule_assignment.json• L23-111 hrms/…/shift_schedule_assignment.py• L31-80 hrms/…/shift_schedule_assignment.py• L82-162
Attendance capture
Attendance capture turns time events into one daily result for each employee and applicable shift. Employees can record check-ins directly or a device can send them. HR can then review the daily result in calendar views or correct it with an attendance request.
Employee check-ins
An Employee Checkin is a time-stamped IN or OUT event for an employee. It may come from a device or another time source. The system matches the event to the employee’s applicable shift and records the planned and allowed shift window used for later attendance processing.
Check-ins outside a valid shift window are kept as off-shift events. They do not produce automatic attendance until a later shift lookup makes them valid. A check-in can also be excluded from automatic attendance. When a shift location is assigned and location tracking is enabled, the check-in must satisfy the location rule before it is accepted.
The employee check-in view guides the employee to the next IN or OUT action. When location tracking is enabled, it collects the employee’s position before submission. HR can fetch shifts again for unlinked logs after an assignment or shift setting changes. A check-in already linked to attendance keeps its existing shift context.
Matching respects assignment boundaries for overnight shifts. It can use the employee’s default shift when no dated assignment applies, but a check-in outside the allowed window remains off-shift.
References: hrms/…/employee_checkin.json• L35-186 hrms/…/employee_checkin.js• L4-57 hrms/…/employee_checkin_list.js• L1-31 hrms/…/employee_checkin_list.js• L50-251 hrms/…/test_employee_checkin.py• L165-235 hrms/…/test_employee_checkin.py• L491-548
Attendance records
An Attendance record is the submitted daily result for one employee and date. It stores the attendance status and can link the applied shift, check-in and check-out times, working hours, attendance request, leave application, and late or early markers. The available statuses are Present, Absent, On Leave, Half Day, and Work From Home.
The record is the business result rather than the raw time event. Automatic processing creates or updates it from valid check-ins. Manual marking can create it directly, including for several unmarked days through a permission-checked bulk action. An approved leave record can change a requested attendance day to On Leave or Half Day. The system prevents duplicate daily records and rejects overlapping shift attendance for the same employee.
Attendance marking checks that the employee is active, that the date is within the employee’s working period, and that the acting user can access the employee. These checks keep manual results aligned with the employee and company scope used by HR operations.
The record is the stable daily result for downstream leave and payroll work. A cancelled attendance record releases its linked check-ins so that the time data can be corrected and processed again.
References: hrms/…/attendance.json• L41-259 hrms/…/attendance.py• L74-278 hrms/…/attendance.py• L387-516 hrms/…/test_employee_checkin.py• L83-117
Attendance calendar
The Attendance calendar presents an employee’s daily attendance results together with holiday events. It loads records for a date range and applies the requested filters and sort order. The calendar can also serve custom calendar views, so the same attendance event source supports more than the standard calendar screen.
Status colors give a quick view of the daily result: absent or on leave days use a danger color, half days use a warning color, present and work-from-home days use a success color, and holidays use the default color.
References: hrms/…/attendance.py• L280-347 hrms/…/attendance_calendar.js• L3-32
Shift attendance report
The Shift Attendance report gives HR a filtered view of shift-based work across a date range. It supports review by company, employee, employment type, shift, and department, with optional views for late entry, early exit, grace-period handling, and attendance that has no check-in record.
The employee filter is limited to the selected company. Changing the company clears the selected employee before the report refreshes, which keeps the two filters aligned. Late entry and early exit are also marked in the report so that exceptions are visible during review.
References: hrms/…/shift_attendance.js• L4-97
Automatic attendance
Automatic attendance turns a completed group of check-ins into one Attendance record for an employee and shift. A Shift Type must enable this behavior and define when processing may start and which check-ins are ready. The process calculates working hours from either the first IN and last OUT or each valid IN and OUT pair.
The result uses the shift thresholds to choose Present, Half Day, or Absent. It also records late entry and early exit when those rules are enabled. Employees with no attendance on a processed working day can be marked Absent after the configured buffer. Holiday checks use the shift’s fixed holiday list when one is set. Otherwise, they follow the employee’s holiday-list assignments across the processed date range. Holidays remain excluded unless the shift allows attendance on holidays. A zero-day buffer requires automatic last-sync updates so the process knows that the shift window has closed. Automatic last-sync updates advance to the latest completed shift end; while the current shift is still open, they use the prior shift end. This keeps full-day and early-morning shifts from closing too soon.
Large manual runs can be queued as one de-duplicated background job. Normal scheduled processing works in employee batches and commits progress as it moves through check-ins and missing attendance. This keeps a large attendance run from depending on one request staying open.
When a half-day leave record already exists, automatic attendance fills in the check-in times and working hours without creating a second daily record. The record keeps its Half Day status while the other half remains open until the actual shift window ends. If no qualifying check-ins exist by then, the other half is marked Absent.
The main flow is:
flowchart LR
A[Employee check-ins] --> B[Match employee and shift]
B --> C[Pair valid IN and OUT events]
C --> D[Calculate working hours]
D --> E[Apply shift thresholds]
E --> F[Submit attendance]
B --> G[No valid check-ins]
G --> H[Mark Absent after the buffer on eligible work days]
References: hrms/…/shift_type.py• L164-252 hrms/…/shift_type.py• L260-321 hrms/…/shift_type.py• L323-450 hrms/…/shift_type.py• L468-538 hrms/…/shift_type.py• L507-536 hrms/…/test_employee_checkin.py• L888-968 hrms/…/test_shift_type.py• L33-153 hrms/…/test_shift_type.py• L958-963
Attendance exceptions
Attendance exceptions explain work that does not match the normal check-in pattern. Attendance requests change the daily result for approved work exceptions. Compensatory leave converts eligible holiday work into future leave.
Attendance requests
An Attendance Request is a submitted request to record Work From Home or On Duty for a date range. It may include holidays and may identify one half-day date. On submission, it creates or updates the related daily Attendance records. On cancellation, it cancels the records that the request created.
The request checks the employee’s shift assignments and fills the shift when one clear shift covers the requested working days. It skips holidays and approved leave by default. It warns when an attendance record already exists and overwrites it only when the request changes the daily result. If a request spans different shifts, it leaves the shift open unless one shift applies to all marked days.
An attendance request cannot overlap another request for the same employee and shift. The request also rejects a range in which every day would be skipped or would keep the same result. This prevents an approved request from appearing to change attendance when it creates no new business result.
References: hrms/…/attendance_request.json• L29-137 hrms/…/attendance_request.js• L3-59 hrms/…/attendance_request.py• L44-119 hrms/…/attendance_request.py• L166-318 hrms/…/test_attendance_request.py• L55-163 hrms/…/test_attendance_request.py• L173-221
Compensatory leave
A Compensatory Leave Request turns work performed on an employee’s holiday into future leave. The request records the worked date range, supports a half-day amount, and requires a leave type and reason. It accepts only holiday dates and checks that the employee has Present, Work From Home, or matching Half Day attendance for the full work period.
After submission, the system adds the earned amount to a Leave Allocation that starts on the day after the worked period. It also creates a leave ledger entry. Cancellation reverses the allocation and ledger entry. Leave configuration and leave-period rules are described in Leave management.
References: hrms/…/compensatory_leave_request.json• L26-114 hrms/…/compensatory_leave_request.py• L43-145
Overtime and payroll
Overtime uses submitted attendance as its source. A shift decides when extra hours are eligible. An overtime slip applies the pay rule and sends the result to payroll without changing the original check-in history.
Overtime measurement
Overtime begins with a Shift Type that allows overtime and names an Overtime Type. When a Present attendance record has working hours above the shift’s standard hours, the record stores the actual overtime duration and the standard hours used for comparison. Overtime is not produced for an attendance result that is not Present.
An Overtime Type defines the daily limit, the pay method, the base salary component or fixed hourly rate, and optional weekend or public-holiday multipliers. These rules describe how an approved overtime duration becomes a pay amount. The holiday lookup covers the full overtime-slip period, so a holiday-list change inside that period can affect the multiplier used for a detail.
References: hrms/…/shift_type.json• L209-225 hrms/…/overtime_type.json• L28-129 hrms/…/overtime_slip.py• L135-193 hrms/…/overtime_slip.py• L219-385
Overtime slips
An Overtime Slip groups an employee’s eligible overtime for a date range. It gathers submitted Present attendance records with an overtime type and turns them into dated Overtime Details. Each sourced detail retains its attendance source, duration, standard hours, and overtime type. A slip can also contain details that are not linked to attendance, subject to the Overtime Type limit.
Submitting the slip calculates each detail with the applicable hourly rate and day multiplier. It then groups the result by overtime salary component and creates Additional Salary records for payroll. Payroll Entry can create and submit slips for eligible employees while the slip remains the record that explains each payroll amount.
References: hrms/…/overtime_slip.json• L30-146 hrms/…/overtime_slip.py• L47-101 hrms/…/overtime_slip.py• L122-217 hrms/…/overtime_slip.py• L416-535
Working-time lifecycle
The working-time lifecycle moves from an expected shift pattern to dated assignments, time events, daily results, and optional pay or leave outcomes. Each stage adds a different kind of fact instead of replacing the earlier one.
- HR defines a Shift Type or a repeating Shift Schedule.
- The system creates a Shift Assignment for the employee and date range.
- The employee or a device records Employee Checkin events.
- Automatic or manual processing creates the daily Attendance result.
- An Attendance Request corrects or explains a work-day exception when needed.
- Present time above the shift standard can flow into an Overtime Slip.
- Holiday work can flow into a Compensatory Leave Request and then a Leave Allocation.
This separation lets a correction target the right stage. A change to the work event affects attendance processing. A request changes the daily business result. A payroll slip uses the submitted result without changing the original check-in history.
References: hrms/…/shift_assignment.json• L29-147 hrms/…/employee_checkin.json• L35-186 hrms/…/attendance_request.py• L216-318 hrms/…/overtime_slip.py• L122-217 hrms/…/compensatory_leave_request.py• L94-145
Change checklist
When these files or sections are changed, remember to consider these:
- When shift timing, grace windows, or attendance thresholds change, review check-in matching, overnight shift behavior, absent-buffer timing, and overtime standard-hour calculations together.
- When automatic attendance sync or absent-buffer rules change, review the point at which check-ins become eligible and the point at which missing attendance becomes Absent.
- When the Attendance status set or its half-day rules change, review Attendance Request results, approved leave checks, compensatory leave validation, and the employee attendance views.
- When Shift Assignment date, timing, location, or cancellation rules change, review shift lookup for check-ins and attendance, schedule-generated assignments, linked-record protection, and shift-request processing.
- When the Shift Assignment Tool changes its actions or filters, review direct assignment, schedule assignment, and shift-request processing as separate paths.
- When manual or bulk attendance marking changes, review employee and company permission checks, date limits, duplicate handling, and the background-job contract for large runs.
- When overtime fields or limits change, review the Attendance-to-Overtime Details link, manually entered detail rules, payroll-entry creation, and the Additional Salary contract used by payroll.
- When holiday lists or their employee assignments change, review absent marking, unmarked-day lookup, attendance-request skips, and overtime multipliers across date ranges that can contain more than one holiday list.
- When compensatory leave timing changes, review the Leave Allocation start date and the matching leave ledger reversal on cancellation.
- When the Shift Attendance report filters change, review company-scoped employee selection, date-range defaults, grace-period handling, and the option to include attendance without check-ins.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A check-in has no matching shift window | The event is treated as off-shift and does not produce automatic attendance | Confirm the employee has an active dated assignment or a usable default shift. |
| A check-in is outside the assigned shift location radius | The event is rejected and cannot support attendance | Submit the check-in within the configured radius or correct the shift location. |
| A shift assignment overlaps another assignment with overlapping times | The assignment is rejected and later attendance cannot rely on that invalid plan | Resolve the date or time overlap, or enable multiple assignments only when the shift windows do not overlap. |
| A shift start time changes while unlinked check-ins still exist | The change is blocked because old logs could be interpreted under new shift rules | Process the unlinked check-ins before changing the shift time. |
| A check-in time changes after it is linked to attendance | The check-in cannot be saved with the new time | Cancel the linked attendance first, then correct and reprocess the time event. |
| A shift assignment is cancelled after it is linked to check-ins or attendance | The cancellation is rejected and the assignment stays active | Correct or remove the linked downstream records before cancelling the assignment. |
| A shift becomes a full-day window after its buffers are added | The shift configuration is rejected because it could overlap itself | Keep the shift and its early and late buffers below one day. |
| A zero absent buffer is used without automatic last-sync updates | Shift configuration is rejected because same-day absence cannot be safely closed | Enable automatic last-sync updates or use a positive absent buffer. |
| Automatic attendance lacks a process date or last-sync point | Check-ins are not eligible for processing and missing days are not closed | Set the processing start and last successful check-in sync for the shift. |
| An attendance request covers approved leave or a holiday without inclusion | The affected day is skipped and no new attendance result is created | Review the request warnings and include holidays only when the work exception is valid. |
| An attendance request overlaps another request or would change no day | The request is rejected instead of creating a misleading record | Use a non-overlapping range with at least one day that needs a new result. |
| A compensatory leave request lacks holiday attendance for every worked day | The request is rejected and no future leave is allocated | Mark valid Present, Work From Home, or matching Half Day attendance for the holiday work period. |
| An overtime slip repeats a date, overlaps another slip, or exceeds a daily limit | The slip cannot be validated or submitted | Keep one detail per date, use one period per employee, and stay within the configured maximum. |
| A schedule creation point moves backward over existing assignments | The schedule update is rejected because it could recreate or conflict with dated shifts | Move the creation point after the latest generated assignment. |
| A report user changes the company after selecting an employee | The employee filter is cleared before the report refreshes, so the report does not keep a cross-company employee selection | Select the employee again from the new company when needed. |
Key files
| File | Why to read it |
|---|---|
| hrms/…/shift_type.json | Defines the shift window, attendance rules, grace periods, holiday behavior, sync controls, and overtime switch. |
| hrms/…/shift_type.py | Shows the high-level automatic attendance flow, absent timing, holiday handling, working-hour thresholds, and shift configuration guards. |
| hrms/…/shift_assignment.json | Defines the dated link between an employee, a shift, a location, and an overtime type. |
| hrms/…/shift_assignment_tool.json | Shows the supported bulk paths for direct shifts, schedules, and shift requests. |
| hrms/…/shift_request.py | Explains approval, overlap checks, and creation or cancellation of the resulting shift assignment. |
| hrms/…/shift_schedule.json | Defines the repeating interval and days that make up a shift pattern. |
| hrms/…/shift_schedule_assignment.py | Shows how a repeating pattern becomes dated shift assignments and continues through background creation. |
| hrms/…/shift_location.json | Defines the geographic point and radius used to validate location-aware check-ins. |
| hrms/…/employee_checkin.json | Defines the raw IN or OUT event, its shift context, attendance link, and location data. |
| hrms/…/employee_checkin_list.js | Shows the employee-facing check-in flow and the off-shift warning. |
| hrms/…/attendance.json | Defines the daily attendance result, statuses, working-hour facts, exception links, and overtime facts. |
| hrms/…/attendance_request.py | Shows how work-day exceptions create, update, skip, or cancel attendance records. |
| hrms/…/shift_attendance.js | Defines the shift attendance review filters and highlights late or early attendance exceptions. |
| hrms/…/overtime_type.json | Defines overtime limits, rate calculation choices, salary inputs, and weekend or public-holiday multipliers. |
| hrms/…/overtime_slip.py | Shows how attendance overtime becomes payroll-ready Additional Salary records and how payroll entry coordinates slips. |
| hrms/…/compensatory_leave_request.py | Shows how holiday work becomes future leave and how cancellation reverses it. |