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

Don't send mail to warn user fill timesheet (weekend and holiday) #206

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
9 changes: 8 additions & 1 deletion staffing/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@license: AGPL v3 or newer (http://www.gnu.org/licenses/agpl-3.0.html)
"""

from datetime import date, timedelta
from datetime import date, timedelta, datetime
from celery import shared_task

from django.urls import reverse
Expand All @@ -16,6 +16,7 @@

from core.utils import get_parameter
from people.models import Consultant
from staffing.models import Holiday
from staffing.utils import gatherTimesheetData


Expand All @@ -25,6 +26,12 @@ 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
today = datetime.today()
if today.weekday() in (5, 6) or Holiday.objects.filter(day=today).exists():
return

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