Skip to content

feat: add new Doctype Bulk Leave Application (DRC-148)#8

Draft
MarcCon wants to merge 18 commits intoversion-15from
drc-148
Draft

feat: add new Doctype Bulk Leave Application (DRC-148)#8
MarcCon wants to merge 18 commits intoversion-15from
drc-148

Conversation

@MarcCon
Copy link
Collaborator

@MarcCon MarcCon commented Apr 9, 2025

This PR introduces a new Bulk Leave Application DocType to simplify the creation of multiple Leave Applications.

Features:

  • on submit, individual Leave Applications are created for each row in the table

@MarcCon MarcCon requested a review from PatrickDEissler April 9, 2025 16:38
PatrickDEissler

This comment was marked as outdated.

@PatrickDEissler
Copy link
Collaborator

PatrickDEissler commented May 14, 2025

This comments the changes that I added on top of Marc's contributions.
Comment is work in progress...

Changes

Small Changes

  • Adjust Permissions: d8a433b
  • Add To Date to grid view: c857107
  • set Leave Approver and limit options to valid approvers only (copied from Leave Application): cd10aaf
  • adjust list view and general form styling (to get more similiarity to Leave Application): 5eab494
  • adjust process (similiar to Leave Application: Request on insert and set final status on submit): fcfc0fd
  • use hr utils function to get holidays: 9a15033 (Marc: General tip: Searching for utils function with a string such as "get_..." often helps. You can check some utils.py files (In erpnext.stock, or in hrms.hr, or others) and just search for "def get_". You will find some useful util-functions and get a better idea of what they cover.

Medium Changes

  • avoid holidays in weekly-offs (Holidays shall not be processes, as they are not necessary and lead to possible inconsistency): 086d2ba

Big Changes

create Attendances instead of Leave Applications: a918ad1

Use Cases to cover:

  1. Time Capture
  2. Leave Application
  3. Bulk Leave Application
  4. Leave Application ("Urlaub") that overwrites Bulk Leave Application ("Überstunden")

To use case 4):

This is a very likely use case. Example: Weekly off for someone who effectively works a four day work-week. When this person goes on vacation, she will apply for, let's say 2 weeks, vacation.

Problem: This kind of Leave Application could not be inserted
Reason:
Bulk Leave Application already created a Leave Application (weekly off) that is within the new Leave Application for vacation ("Urlaub"). This is not allowed in HRMS' leave_application.py

Solution:
Create Attendances (On Leave) without Leave Application.

Follow Up Problem: No Leave Ledgers are created

Employee's leave balance is unchanged

  • -> Solution: Not all Leave Types shall be allowed for Bulk Leave Application. Example: "Urlaub" shall not be allowed. "Überstundenabbau" or "Berufsschule" can be allowed.

Follow Up Problem: "Urlaub" Leave Application updates the existing Attendance with an an un-distinctive hook

It is important, that we recognize the change in Leave Type to calculate the Flexitime etc.

doc.db_set is used. That can only be recognized via on_change hook. doc.has_value_changed also does not work as needed in that case.
Result: Using the on_change will run the indistinctively and often.

Follow Up Problem:
a) Bad Design (might be triggered too often without any use).

-> Solution: We accept that...

b) Un-related update of the Attendance: Example: The Attendance is updated a year later, let's say because a custom color field was added and this is set for all existing Attendances via patch. That re-calculates the Flexitime etc. This can lead to wrong data because the Expected Daily Working Time is float field in Employee, which can change if an Employee's contract changed. Now, the 1 year old Attendance is re-calculated with the current Expected Daily Working Time.

Todo

  • Undo this: 51bbaf8
  • Check if I should remove holidays in general, not just for weekly-offs
  • Don't allow Bulk Leave Applications for the past.
  • (Maybe something else): Half Days...
  • Solve the mentioned problems.
  • Cancel Bulk Leave Application.
  • Discuss: How are the relevant employees (PU) contracted? 4 days workweek or 5 days?
  • Hand this comment over to Marc.

Todo after Review/Test:

  • Create Notification: To Leave Approver.
  • Create Notification: To Employee
  • Create Notification: To Employee (before Bulk Leave Application expires)

@PatrickDEissler PatrickDEissler marked this pull request as draft November 5, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants