Work Entries from Attendance
Automatically create work entries from actual check-in/check-out data
The Work Entries - Attendance module extends the Work Entry module to create work entries based on actual attendance data (check_in/check_out) instead of just static work schedules.
This module automatically creates work entries when attendance is closed, synchronizes when editing/deleting attendance, manages overtime from attendance overtime data, and blocks editing/deleting attendance if related work entries are already in payslips.
Key features
Key points
• Automatically create work entries when attendance is closed (has check-out)
• Synchronize work entries when editing/deleting attendance
• Manage overtime from attendance overtime data
• Block editing/deleting attendance if related work entries are in payslips (validated)
• Support configuration for calculating overtime into work entries
When to use Attendance source
Use when the business needs to calculate salary based on actual working hours instead of standard schedule hours. Suitable for employees with flexible work, not following fixed schedules.
Important terminology
| Fields | Trường dữ liệu | Description |
|---|---|---|
| Attendances | Chấm công | Employee check-in/check-out data |
| Attendance | Bản ghi chấm công | One check-in/check-out record |
| Overtime | Tăng ca | Hours worked beyond standard hours |
| Overtime Rule | Quy tắc tăng ca | Configuration for overtime calculation |
| Work Entry Source | Nguồn bút toán công | Entry source: Working Schedule, Attendance, or Planning |
| Extra Hours | Giờ tăng ca | Overtime hours |
Configure Attendance source
To use attendance as the source for creating work entries, configure it on the employee record.
Steps
1. Open employee record (Employees → Employees)
2. Go to contract/version information section
3. In Work Entry Source field, select: Attendance
4. Save employee record
Configure overtime from attendance
On employee version, you can enable Extra hours (overtime_from_attendance). If enabled, the system will include approved overtime lines in work entries according to the work entry type of the overtime rule.
Process for creating work entries from check-in/check-out
When creating attendance, if there is no check_out, no work entry is created. When check_out exists, the system automatically finds the employee version overlapping the time period and generates corresponding work entries.
Key points
• System finds old work entries matching employee + date
• Compares by time interval
• Old work entries within new interval are archived (active=False)
• Partially overlapping work entries have attendance_id link removed
• Goal: avoid duplicate hours and keep data clean for payroll
Managing overtime from attendance
Each overtime rule has work_entry_type_id and amount_rate (automatically taken from work entry type). When overtime is approved, the system generates overtime work entries with the correct type so payroll reads the correct salary rate.
Key points
• Rate combination mode: max takes work entry type with highest amount_rate, split creates multiple work entries per rule
• Refused overtime: System subtracts refused overtime hours from working interval
Validation status and edit restrictions
If attendance is linked to work entry with state=validated, cannot write or unlink attendance. System shows error to protect locked payroll data.
Key points
• Cannot edit attendance when already in payslip
• Regenerate will automatically skip validated records
Regenerate work entries when editing/deleting attendance
When editing check-in/check-out, system finds work entry by employee + date, calls regenerate wizard for impacted slot, nullifies old attendance link, and regenerates work entry according to new attendance data.
Key points
• When deleting attendance: System runs error checking first, deletes attendance, regenerates work entries for affected dates/employees
• Result: Work entry data always consistent after attendance operations
Payroll integration
This module helps payroll retrieve data according to actual working hours. Regular work entries are taken from attendance interval, overtime work entries are taken from approved overtime lines.
Salary calculation example
| Type | Hours | Rate | Work entry type |
|---|---|---|---|
| Regular attendance | 8 hours | 100% | Attendance |
| Approved overtime | 2 hours | 150% | Overtime 150% |
Practical operation tips
Key points
• Only enable Attendance source for employees who actually clock in/out by actual hours
• Lock overtime rules before pay period to avoid multiple regenerations
• Limit editing old attendance after payroll has started
• Before locking payslip, filter and check for work entry conflicts and unusual missing attendance/overtime links
• For large data edits, regenerate by date range instead of manually editing each line