fix condition for changing status to submitted

This commit is contained in:
2024-01-18 22:44:41 +00:00
parent 51d6a89d11
commit 0091339014

View File

@@ -386,9 +386,12 @@ class WirefAdmin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
# set status to submitted, if a file exists and status is opened.
get_status_open = obj.status == Wiref.Status.OPENED
get_exist_file = obj.file_field != ""
if get_exist_file and get_status_open and "_generate_pdf" not in request.POST:
if (
change is True
and obj.file_field != ""
and obj.status == Wiref.Status.OPENED
and "_generate_pdf" not in request.POST
):
obj.status = Wiref.Status.SUBMITTED
super().save_model(request, obj, form, change)