Skip to content

Commit dab2129

Browse files
committed
Don't send mail to fill timesheet weekend and holiday
1 parent 203991e commit dab2129

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

staffing/tasks.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ def warn_for_incomplete_timesheet(warn_overbooking=False, days=None, month="last
2525
:param warn_overbooking: Warn for overbooking days (default is false)
2626
:param days: only check n first days. If None (default), check all month
2727
:param month: Month to check: current or last (default) month"""
28+
29+
# Don't send mail weekend or holiday
30+
now = datetime.now()
31+
today = now.today()
32+
holiday_today = Holiday.objects.filter(day=today)
33+
if (now.weekday() in (5, 6) or holiday_today.count() > 0):
34+
return
35+
2836
email_template = get_template("batch/timesheet_warning_email.txt")
2937
if month == "current":
3038
#TODO use core.utils nextMonth()

0 commit comments

Comments
 (0)