From ebb1de764c3e7ab5afb7b069114e6185a0758b75 Mon Sep 17 00:00:00 2001 From: Horilla Date: Fri, 10 Jan 2025 12:56:28 +0530 Subject: [PATCH] [FIX] BASE: Fixed migration issue on first load --- base/forms.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/base/forms.py b/base/forms.py index 1e003f367..3559d9154 100644 --- a/base/forms.py +++ b/base/forms.py @@ -2183,12 +2183,9 @@ class MultipleApproveConditionForm(ModelForm): ("ge", _("Greater Than or Equal To (>=)")), ("icontains", _("Contains")), ] - choices = [("reporting_manager_id", _("Reporting Manager"))] + [ - (employee.pk, str(employee)) for employee in Employee.objects.all() - ] multi_approval_manager = forms.ChoiceField( - choices=choices, + choices=[], widget=forms.Select(attrs={"class": "oh-select oh-select-2 mb-2"}), label=_("Approval Manager"), required=True, @@ -2212,6 +2209,13 @@ class MultipleApproveConditionForm(ModelForm): "is_active", ] + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + choices = [("reporting_manager_id", _("Reporting Manager"))] + [ + (employee.pk, str(employee)) for employee in Employee.objects.all() + ] + self.fields["multi_approval_manager"].choices = choices + class DynamicPaginationForm(ModelForm): """