Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions hrms/hr/doctype/shift_request/shift_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def validate(self):
self.validate_overlapping_shift_requests()
self.validate_approver()
self.validate_default_shift()
self.validate_status_change()

def on_update(self):
share_doc_with_approver(self, self.approver)
Expand Down Expand Up @@ -154,3 +155,13 @@ def throw_overlap_error(self, shift_details):
)

frappe.throw(msg, title=_("Overlapping Shift Requests"), exc=OverlappingShiftRequestError)

def validate_status_change(self):
if frappe.has_permission("Shift Request", "submit", self):
return

if self.status != "Draft":
frappe.throw(
_("You do not have permission to change the Status of a Shift Request."),
frappe.PermissionError,
)
4 changes: 4 additions & 0 deletions hrms/payroll/doctype/salary_component/salary_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,7 @@ def update_salary_structures(
"label": _("via Salary Component sync"),
}
salary_structure.save_version()
# db_update_all() does not invalidate cached Salary Structure documents.
# Clear the cache so salary slip generation picks up updated formulas
# and conditions immediately.
salary_structure.clear_cache()
Loading