[UPDT] not allow employees from answering feedback if it does not sta… (#491)

* [UPDT] not allow employees from answering feedback if it does not started yet

* [FIX] fix holiday edit form it raise error for missing company_id field

---------

Co-authored-by: Mahmoud Nasser <mahmoudnasser@Mahmouds-MacBook-Air.local>
This commit is contained in:
Mahmoud Nasser Abdulhamed
2025-02-17 13:11:58 +02:00
committed by GitHub
parent b3ba239272
commit 288f1fc030
2 changed files with 11 additions and 1 deletions

View File

@@ -38,6 +38,10 @@
<label class="oh-label d-block" for="{{ form.recurring.id_for_label }}">{% trans "Recurring" %}</label>
<div class="oh-switch">{{form.recurring}} {{form.recurring.errors}}</div>
<label class="oh-label d-block" for="{{ form.recurring.id_for_label }}">{% trans "Company" %}</label>
<div class="oh-switch">{{ form.company_id }} {{ form.company_id.errors }}</div>
<div class="oh-modal__dialog-footer p-0">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Save" %}

View File

@@ -1828,9 +1828,15 @@ def feedback_answer_get(request, id, **kwargs):
it will redirect to feedaback_answer.html .
"""
feedback = Feedback.objects.get(id=id)
# check if the feedback start_date is not started yet
if feedback.start_date > datetime.date.today():
messages.info(request, _("Feedback not started yet"))
return redirect(feedback_list_view)
user = request.user
employee = Employee.objects.filter(employee_user_id=user).first()
feedback = Feedback.objects.get(id=id)
answer = Answer.objects.filter(feedback_id=feedback, employee_id=employee)
question_template = feedback.question_template_id
questions = question_template.question.all()