Revert "[UPDT] BASE: Company field in form is updated to show only selected company"
This reverts commit d8403d2381.
This commit is contained in:
@@ -552,8 +552,6 @@ def reload_queryset(fields):
|
||||
"Employee": {"is_active": True},
|
||||
"Candidate": {"is_active": True} if apps.is_installed("recruitment") else None,
|
||||
}
|
||||
request = getattr(_thread_locals, "request")
|
||||
selected_company = request.session.get("selected_company")
|
||||
|
||||
for field in fields.values():
|
||||
if isinstance(field, ModelChoiceField):
|
||||
@@ -561,10 +559,6 @@ def reload_queryset(fields):
|
||||
filter_criteria = model_filters.get(model_name)
|
||||
if filter_criteria is not None:
|
||||
field.queryset = field.queryset.model.objects.filter(**filter_criteria)
|
||||
elif selected_company and not selected_company == "all":
|
||||
field.queryset = field.queryset.model.objects.filter(
|
||||
id=selected_company
|
||||
)
|
||||
else:
|
||||
field.queryset = field.queryset.model.objects.all()
|
||||
|
||||
|
||||
@@ -1707,7 +1707,7 @@ class CompanyLeaves(HorillaModel):
|
||||
)
|
||||
based_on_week_day = models.CharField(max_length=100, choices=WEEK_DAYS)
|
||||
company_id = models.ForeignKey(Company, null=True, on_delete=models.PROTECT)
|
||||
objects = HorillaCompanyManager()
|
||||
objects = HorillaCompanyManager(related_company_field="company_id")
|
||||
|
||||
class Meta:
|
||||
unique_together = ("based_on_week", "based_on_week_day")
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
|
||||
<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" %}
|
||||
|
||||
Reference in New Issue
Block a user