Игорь Надеин abef43136b
All checks were successful
Deploy production / deploy (push) Successful in 11m16s
Apply automatic payroll input transfer when closing periods
2026-10-19 10:47:57 +03:00

26 lines
681 B
Python

"""Periodic Finance tasks."""
from __future__ import annotations
from datetime import date
from celery import shared_task
from django.utils import timezone
from finance.payroll.periods import ensure_calendar_payroll_period
def ensure_monthly_payroll_period(reference_date: date | None = None):
return ensure_calendar_payroll_period(
reference_date or timezone.localdate(),
metadata={"schedule": "monthly"},
)
@shared_task
def open_monthly_payroll_period():
"""Open the current calendar month's payroll period."""
period, created = ensure_monthly_payroll_period()
return {"period_id": period.pk, "code": period.code, "created": created}