Skip to content

Commit

Permalink
[UPDT] PAYROLL: Changed signals to signals.py
Browse files Browse the repository at this point in the history
  • Loading branch information
horilla-opensource committed Feb 28, 2025
1 parent 123e791 commit add2f4f
Show file tree
Hide file tree
Showing 6 changed files with 302 additions and 296 deletions.
11 changes: 0 additions & 11 deletions base/templatetags/horillafilters.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,6 @@ def base64_encode(value):
pass


@register.filter(name="current_month_record")
def current_month_record(queryset):
current_month_start_date = datetime.now().replace(day=1)
next_month_start_date = current_month_start_date + timedelta(days=31)

return queryset.filter(
start_datetime__gte=current_month_start_date,
start_datetime__lt=next_month_start_date,
).order_by("start_datetime")


@register.filter
def get_item(list, i):
try:
Expand Down
1 change: 1 addition & 0 deletions payroll/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def ready(self) -> None:

from horilla.horilla_settings import APPS
from horilla.urls import urlpatterns
from payroll import signals

APPS.append("payroll")
urlpatterns.append(
Expand Down
17 changes: 17 additions & 0 deletions payroll/methods/deductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,20 @@ def update_compensation_deduction(
"deductions": deductions,
"difference_amount": difference_amount,
}


def create_deductions(instance, amount, date):
installment = Deduction()
installment.title = f"{instance.title} - {date}"
installment.include_active_employees = False
installment.amount = amount
installment.is_fixed = True
installment.one_time_date = date
installment.only_show_under_employee = True
installment.is_installment = True
installment.save()
installment.include_active_employees = False
installment.specific_employees.add(instance.employee_id)
installment.save()

return installment
Loading

0 comments on commit add2f4f

Please sign in to comment.