-
Notifications
You must be signed in to change notification settings - Fork 7.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Scheduling Multiple shifts and Auto Attendance #29955
Conversation
318c644
to
0231760
Compare
base_dates_query = """select adddate(%(start_date)s, t2.i*100 + t1.i*10 + t0.i) selected_date from | ||
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0, | ||
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t1, | ||
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t2""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than converting calculation based on payment_days or normalisation, can we provide a Select Dropdown in salary component called Depends On and show these options - No dependency, Shift Payment Days, Total_Shift_Payment_Days, Total Working Hours, Total Working Minutes, Shift_Working_Hours, Shift_Working_Minutes ? Using this setting the calculation method/function can be selected in Salary slip code as well. Total Payment Days
Shift Payment Days
Shift Working Hours or Minutes
Total Shift Working Hours or minutes
P.S. Working Minutes is something we use in our organisation. Similar is used in middle east areas. Because based on my knowledge in Islamic Shariah employee salary has to be calculated based on minutes and not hours. |
Additionally we have to edit Leave Application Form. The From Date and To Date fields has to change to the type DateTime. so that we can calculate which shift hours user was on leave. |
a300991
to
0733cfa
Compare
- convert raw query to frappe.qb - check for overlapping timings if dates overlap - translation friendly error messages with link to overlapping doc
- break down into smaller functions - make it work with multiple shifts - this will mark employee as absent per shift, meaning employee can be present for one shift and absent for another on the same day
- split into smaller functions - add type hints - get rid of unnecessary db calls and loops - add docstrings for functions
- legend with colors and full form for status abbreviations
a5d08d9
to
9956ac0
Compare
Codecov Report
@@ Coverage Diff @@
## develop #29955 +/- ##
===========================================
+ Coverage 60.91% 61.15% +0.24%
===========================================
Files 1083 1083
Lines 69141 69306 +165
===========================================
+ Hits 42119 42386 +267
+ Misses 27022 26920 -102
|
04e6b38
to
0a3cf64
Compare
- check half day attendance threshold before absent threshold to avoid half day getting marked as absent - round working hours to 2 digits for better accuracy - start and end dates for absent attendance marking
fix test setups
043a409
to
6fffdcf
Compare
- commonify time overlap function between request and assignment - add tests for shift request overlap
- skip auto attendance in case of overlapping shift attendance record - this case won't occur in case of shift assignment, since it will not allow overlapping shifts to be assigned - can happen if manual attendance records are created
Unrelated test failures |
This reverts commit f208903.
Problem
What Changes?
Schedule multiple shifts
Shift Request
Fetching shift in Employee Check In
Attendance
Attendance Reports
Before:

After:

Impact on Payroll
If there are multiple attendance records marked for a single day with separate shifts, each record will be considered as 1 Payment Day in payroll. So if an employee works 2 shifts in a single day this contributes to 2 payment days in Payroll. No code level changes are done for this
Documentation: Added docs for Monthly Attendance Sheet only since others are mostly backend changes: https://docs.erpnext.com/docs/v14/user/manual/en/human-resources/human-resources-reports/edit?wiki_page_patch=ea798a28e2
Also closes #29210
ToDo