Paying hourly/shift workers from Attendance working_hours (without Timesheets)

Hi everyone,

In Frappe HR v16, we now have Overtime Slip to handle extra hours from Attendance, which is a great step forward. However, as confirmed in recent discussions, Salary Slip still does not read working_hours from Attendance for regular hourly payroll or short hours, total_working_hours on the Salary Slip is only populated if salary_slip_based_on_timesheet is enabled.

For companies tracking shifts via biometric check-ins (Employee Checkin → Attendance), forcing employees or HR to create redundant Timesheets, or writing custom scripts to generate Additional Salary records for every payroll run, adds unnecessary friction when the exact hours are already sitting on the submitted Attendance records.

This gap has come up repeatedly across the forum:

Proposed Core Solution Instead of altering Salary Slip day-proration logic or requiring custom hooks, we can bridge this natively with a lightweight change:

  1. Salary Structure: Add a checkbox calculate_working_hours_from_attendance (“Calculate Working Hours from Attendance”), visible when salary_slip_based_on_timesheet is unchecked.

  2. Salary Slip:

    • Fetch calculate_working_hours_from_attendance from the Salary Structure and display total_working_hours when either Timesheet or Attendance hours are enabled.

    • During get_working_days_details(), if calculate_working_hours_from_attendance is checked, sum working_hours from submitted Attendance records (Present, Half Day, Work From Home) between start_date and end_date using frappe.qb and set self.total_working_hours.

  3. Formula Support: Because all Salary Slip fields are automatically exposed to the Salary Component formula evaluator, HR teams can immediately write component formulas like base * total_working_hours (or calculate short-hour deductions) natively without touching custom scripts or overrides.

GitHub Issue: feat(payroll): Calculate Total Working Hours on Salary Slip from Attendance · Issue #5566 · frappe/hrms · GitHub

Tagging a few members who have discussed or looked into this workflow recently: @Meet-Tank4 @Sudhanshu @TrilliumPeter @wojosc @Teddy_Ted @shtorky @bandarivijay, would love to hear your thoughts!

If having total_working_hours populated directly from Attendance would simplify your payroll setup, please click the :+1: on the GitHub issue and reply below with your use case so we can help get this prioritized for v16!

This would be a useful addition, especially for companies using biometric devices and Employee Checkins to manage attendance.I’ve worked on biometric attendance integration, and being able to use working hours directly from Attendance for payroll calculations would definitely simplify the process.One thing I’d consider is how this would handle overnight shifts, half-days, missing check-ins/check-outs, and approved overtime, since these can affect payable hours.Making this optional in Salary Structure sounds like a good approach, while keeping the existing Timesheet-based workflow available.

Hi, thanks for raising this. I agree it’s a real gap. The hours are already on the Attendance, so making people create Timesheets or write scripts just for this feels unnecessary.

The overall approach looks fine to me: a checkbox on Salary Structure, then summing submitted Attendance working_hours (Present, Half Day, Work From Home) for the slip period. A few points to settle before anyone implements it:

  1. Separate field or reuse total_working_hours?
    That field is already used by the Timesheet flow, in the max-hours check and the wages calculation. If we reuse it, the two modes must never run together. A separate field like total_attendance_hours is safer, though it adds one more field. I’d lean towards the separate field.

  2. Overtime double payment.
    Attendance hours already include overtime. If someone pays by hours and also creates an Overtime Slip, the same hours get paid twice. Options:

    • Subtract hours already covered by an Overtime Slip.
    • Cap the hours at the standard shift hours.
    • Only show a warning on the checkbox.

    The first two are more accurate, and the warning is

  3. Attendance with 0 hours.
    If an Attendance was marked manually with no check-mployee gets nothing for that day. Should the slip show a message listing those days so HR can fix them before submitting?

  4. Which records to count.
    Only docstatus = 1, within the slip dates, and limited by the joining and relieving dates. Ideally this reuses the Attendance data the
    slip already fetches, so there’s no extra query percount as they are, or be adjusted?

  5. Short-hour deductions.
    These need the expected hours too (from the shift o actual hours. That could be a follow-up, since it’s adifferent problem from this issue.

@FredericVerville could you share how you pay your employees? For example, is it fully hourly, or do you only use hours to deduct for short hours? Do you also use Overtime Slips? That will help decide work.

Thanks @Sudhanshu and @Anishakarki05 for jumping into this and helping scope it properly!

@Sudhanshu, here is how our payroll works in practice and my thoughts on your 5 design points:

How we currently pay our employees

We pay our production and shift employees 100% hourly (Hour Rate * Total Working Hours) on a fortnightly payroll cycle:

  • Employees punch in and out via Employee Checkin, which automatically generates Attendance records with the exact decimal working_hours for each shift (e.g., 7.85 hours, 8.20 hours).

  • In ERPNext, the standard way to pay an hourly wage on a Salary Structure is enabling Salary Slip Based on Timesheet, defining an Hour Rate and a base Salary Component, and letting the Salary Slip multiply hour_rate * total_working_hours.

  • Because Salary Slip only populates total_working_hours from Timesheets, we had to build an automation that sums each employee’s Attendance.working_hours at the end of every 2-week period and generates a single dummy Timesheet per employee (e.g., one Timesheet with 49.61 total hours) just so the Salary Slip can calculate their base hourly pay.

  • All statutory deductions, taxes, vacation accruals, and employer contributions are then calculated via component formulas referencing that gross hourly earning.

  • We don’t use Overtime Slip right now, our main goal is simply eliminating those dummy summary Timesheets when the exact hours are already recorded on submitted Attendance documents.

Thoughts on your 5 design points

1. Separate field (total_attendance_hours) vs reusing total_working_hours Because our current setup uses the native Hour Rate × Total Working Hours calculation on the Salary Structure (as well as referencing hours in component formulas), there are two ways to look at this:

  • If we reuse total_working_hours: We can make salary_slip_based_on_timesheet and calculate_working_hours_from_attendance mutually exclusive on the Salary Structure (only one can be enabled at a time). The big advantage here is that existing hour_rate wages calculation, max-hours validation, and formulas work out of the box without duplicating fields on Salary Structure and Salary Slip.

  • If we use a separate total_attendance_hours field: That is also completely fine and very safe if we expose total_attendance_hours to the Salary Component formula evaluator (so users can write base * total_attendance_hours or hour_rate * total_attendance_hours). However, if someone wants to use the standard Hour Rate field on Salary Structure without Timesheets, reusing total_working_hours (with mutual exclusivity) might feel more cohesive in the UI. I’m happy with whichever direction you prefer for core maintainability!

2. Overtime double payment Great catch. If someone uses both hourly Attendance payroll and v16 Overtime Slips:

  • Since Attendance in v16 already calculates actual_overtime_duration when Overtime is enabled on the Shift Type, subtracting actual_overtime_duration from working_hours (or capping at standard_working_hours when overtime is enabled/submitted) is the cleanest and most accurate approach.

  • That way, the base hourly calculation only pays regular shift hours, and Overtime Slip handles the overtime multiplier via Additional Salary without double-counting.

3. Attendance with 0 hours Yes! Showing a non-blocking warning/alert (frappe.msgprint) when creating/validating the Salary Slip that lists any Present, Half Day, or Work From Home Attendance dates in the period where working_hours == 0 would be super helpful for HR to catch missed check-outs or manual entries before submitting payroll.

4. Which records to count & Half Days

  • Records: docstatus = 1, status in ("Present", "Half Day", "Work From Home"), within start_date and end_date (and bounded by joining_date / relieving_date), reusing the Attendance data get_working_days_details() already fetches so there is no extra query per slip.

  • Half Days: Count working_hours as they are (actual decimal hours worked). For hourly workers, if a shift threshold marks a day as Half Day because they worked 3.75 hours, they still need to be paid for the exact 3.75 hours recorded on the Attendance.

5. Short-hour deductions 100% agreed, keeping expected_working_hours and short-hour deductions for salaried employees as a separate follow-up keeps this issue clean and focused.