Skip to content
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

Prevent destination facility from marking shift as complete #2114

Merged
merged 8 commits into from
Jun 24, 2024
9 changes: 8 additions & 1 deletion care/facility/api/serializers/shifting.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,15 @@ def update(self, instance, validated_data):
if (
"status" in validated_data
and validated_data["status"] == REVERSE_SHIFTING_STATUS_CHOICES["COMPLETED"]
and not has_facility_permission(user, instance.origin_facility)
):
discharge_patient(instance.patient)
vigneshhari marked this conversation as resolved.
Show resolved Hide resolved
raise ValidationError(
{
"status": [
"Permission Denied - Only staff from the origin facility can mark the shift as complete."
]
}
)

old_status = instance.status
new_instance = super().update(instance, validated_data)
Expand Down
Loading