diff --git a/hrms/hr/doctype/shift_request/shift_request.py b/hrms/hr/doctype/shift_request/shift_request.py index 2ae9a82f59..a7f7b6217f 100644 --- a/hrms/hr/doctype/shift_request/shift_request.py +++ b/hrms/hr/doctype/shift_request/shift_request.py @@ -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) @@ -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, + ) diff --git a/hrms/payroll/doctype/salary_component/salary_component.py b/hrms/payroll/doctype/salary_component/salary_component.py index bce6314d01..860d74f063 100644 --- a/hrms/payroll/doctype/salary_component/salary_component.py +++ b/hrms/payroll/doctype/salary_component/salary_component.py @@ -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()