Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic include_all fixed for Deduction form and Allowance form #564

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions horilla/horilla_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@

# Default LDAP settings
DEFAULT_LDAP_CONFIG = {
"LDAP_SERVER": "ldap://127.0.0.1:389",
"BIND_DN": "cn=admin,dc=horilla,dc=com",
"BIND_PASSWORD": "horilla",
"BASE_DN": "ou=users,dc=horilla,dc=com",
"LDAP_SERVER": settings.env('LDAP_SERVER'),
"BIND_DN": settings.env('BIND_DN'),
"BIND_PASSWORD": settings.env('BIND_PASSWORD'),
"BASE_DN": settings.env('BASE_DN'),
}


Expand Down
10 changes: 10 additions & 0 deletions payroll/forms/component_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ def clean(self, *args, **kwargs):
cleaned_data["end_range"] = None

def save(self, commit: bool = ...) -> Any:
specific_employees = self.data.getlist("specific_employees")
include_all = self.data.get("include_active_employees")
condition_based = self.data.get("is_condition_based")
if not specific_employees and not include_all and not condition_based:
self.instance.include_active_employees = True
super().save(commit)
other_conditions = self.data.getlist("other_conditions")
other_fields = self.data.getlist("other_fields")
Expand Down Expand Up @@ -315,6 +320,11 @@ def as_p(self):
return table_html

def save(self, commit: bool = ...) -> Any:
specific_employees = self.data.getlist("specific_employees")
include_all = self.data.get("include_active_employees")
condition_based = self.data.get("is_condition_based")
if not specific_employees and not include_all and not condition_based:
self.instance.include_active_employees = True
super().save(commit)
other_conditions = self.data.getlist("other_conditions")
other_fields = self.data.getlist("other_fields")
Expand Down
14 changes: 0 additions & 14 deletions payroll/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,13 +1042,6 @@ def __str__(self) -> str:

def save(self):
super().save()
if (
not self.include_active_employees
and not self.specific_employees.first()
and not self.is_condition_based
):
self.include_active_employees = True
super().save()


class Deduction(HorillaModel):
Expand Down Expand Up @@ -1331,13 +1324,6 @@ def __str__(self) -> str:

def save(self):
super().save()
if (
not self.include_active_employees
and not self.specific_employees.first()
and not self.is_condition_based
):
self.include_active_employees = True
super().save()


class Payslip(HorillaModel):
Expand Down