From 7f56e4ed713916da187c835d73087a19b0549d0a Mon Sep 17 00:00:00 2001 From: Horilla Date: Mon, 13 Oct 2025 16:54:53 +0530 Subject: [PATCH] [FIX] EMPLOYEE: Fixed the employee field changing in document upload --- employee/templates/tabs/htmx/document_form.html | 5 +---- employee/views.py | 3 ++- horilla_documents/forms.py | 9 ++++++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/employee/templates/tabs/htmx/document_form.html b/employee/templates/tabs/htmx/document_form.html index 74d16d9d6..64101b709 100644 --- a/employee/templates/tabs/htmx/document_form.html +++ b/employee/templates/tabs/htmx/document_form.html @@ -10,13 +10,10 @@
{% csrf_token %} - {% if form.employee_id %} - - {% elif form.candidate_id %} + {% if form.candidate_id %} {% endif %} {{ form.non_field_errors }} -
diff --git a/employee/views.py b/employee/views.py index 1438d3d21..0f68ff3e9 100755 --- a/employee/views.py +++ b/employee/views.py @@ -773,7 +773,8 @@ def file_upload(request, id): except: pass return HttpResponse("") - + else: + logger.error(f"Document upload form errors: {form.errors}") context = {"form": form, "document": document_item} return render(request, "tabs/htmx/document_form.html", context=context) diff --git a/horilla_documents/forms.py b/horilla_documents/forms.py index 88790383b..08d9f853e 100644 --- a/horilla_documents/forms.py +++ b/horilla_documents/forms.py @@ -81,7 +81,14 @@ class DocumentUpdateForm(ModelForm): class Meta: model = Document fields = "__all__" - exclude = ["is_active"] + exclude = [ + "title", + "document_request_id", + "status", + "created_by", + "modified_by", + "employee_id", + ] widgets = { "issue_date": forms.DateInput( attrs={"type": "date", "class": "oh-input w-100"}