Skip to content

Commit

Permalink
Don't send mail to fill timesheet weekend and holiday
Browse files Browse the repository at this point in the history
  • Loading branch information
bport committed Feb 23, 2025
1 parent 203991e commit dab2129
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions staffing/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ def warn_for_incomplete_timesheet(warn_overbooking=False, days=None, month="last
:param warn_overbooking: Warn for overbooking days (default is false)
:param days: only check n first days. If None (default), check all month
:param month: Month to check: current or last (default) month"""

# Don't send mail weekend or holiday
now = datetime.now()
today = now.today()
holiday_today = Holiday.objects.filter(day=today)
if (now.weekday() in (5, 6) or holiday_today.count() > 0):
return

email_template = get_template("batch/timesheet_warning_email.txt")
if month == "current":
#TODO use core.utils nextMonth()
Expand Down

0 comments on commit dab2129

Please sign in to comment.