[UPDT] HORILLA WIDGETS: Change orginal_template_name to default_select_option_template

This commit is contained in:
Horilla
2025-04-17 10:40:33 +05:30
parent ffc958e033
commit 8007d10b35
4 changed files with 8 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ from employee.filters import EmployeeFilter
from employee.models import Employee
from horilla_automations.methods.methods import generate_choices
from horilla_automations.models import MODEL_CHOICES, MailAutomation
from horilla_widgets.forms import orginal_template_name
from horilla_widgets.forms import default_select_option_template
from horilla_widgets.widgets.horilla_multi_select_field import HorillaMultiSelectField
from horilla_widgets.widgets.select_widgets import HorillaMultiSelectWidget
@@ -73,7 +73,7 @@ class AutomationForm(ModelForm):
)
for _field_name, field in self.fields.items():
if isinstance(field.widget, forms.Select):
field.widget.option_template_name = orginal_template_name
field.widget.option_template_name = default_select_option_template
class Meta:
model = MailAutomation

View File

@@ -10,7 +10,7 @@ from django import forms
from horilla_widgets.widgets.horilla_multi_select_field import HorillaMultiSelectField
orginal_template_name = forms.Select.option_template_name
default_select_option_template = forms.Select.option_template_name
forms.Select.option_template_name = "horilla_widgets/horilla_select_option.html"

View File

@@ -21,7 +21,7 @@ from employee.filters import EmployeeFilter
from employee.models import BonusPoint, Employee
from horilla import horilla_middlewares
from horilla.methods import get_horilla_model_class
from horilla_widgets.forms import HorillaForm, orginal_template_name
from horilla_widgets.forms import HorillaForm, default_select_option_template
from horilla_widgets.widgets.horilla_multi_select_field import HorillaMultiSelectField
from horilla_widgets.widgets.select_widgets import HorillaMultiSelectWidget
from notifications.signals import notify
@@ -235,7 +235,7 @@ class DeductionForm(forms.ModelForm):
self.fields["style"].widget = widget.StyleWidget(form=self)
for field_name, field in self.fields.items():
if isinstance(field.widget, forms.Select):
field.widget.option_template_name = orginal_template_name
field.widget.option_template_name = default_select_option_template
def clean(self, *args, **kwargs):
cleaned_data = super().clean(*args, **kwargs)

View File

@@ -9,8 +9,7 @@ from payroll.methods.deductions import create_deductions
from payroll.models.models import Allowance, Contract, Deduction, LoanAccount, Payslip
@receiver(post_save, sender=EmployeeWorkInformation)
@receiver(pre_save, sender=EmployeeWorkInformation)
def employeeworkinformation_pre_save(sender, instance, **_kwargs):
"""
This method is used to override the save method for EmployeeWorkInformation Model
@@ -21,7 +20,8 @@ def employeeworkinformation_pre_save(sender, instance, **_kwargs):
else None
)
if active_employee is not None:
contract_exists = active_employee.contract_set.exists()
all_contracts = Contract.objects.entire()
contract_exists = all_contracts.filter(employee_id_id=active_employee).exists()
if not contract_exists:
contract = Contract()
contract.contract_name = f"{active_employee}'s Contract"