emails notification timeout set in the settings
This commit is contained in:
parent
ff7940e3de
commit
cb46224d7a
|
@ -11,6 +11,7 @@ from synchro_orleans.data.models import Facture, InvoiceNotificationEmail
|
|||
|
||||
tmp_json_location = settings.INVOICES_MAIL_DIR
|
||||
json_location = settings.INVOICES_MAIL_LOCATION_PATTERN
|
||||
notification_timeout = settings.INVOICES_NOTIFICATION_TIMEOUT
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
|
@ -22,7 +23,7 @@ class Command(BaseCommand):
|
|||
famille__liaisonnameidfamille__isnull=False, paye=False):
|
||||
try:
|
||||
notification = InvoiceNotificationEmail.objects.filter(invoice_number=invoice.id).latest()
|
||||
if notification.date_sent < make_aware(datetime.now(), get_current_timezone()) - timedelta(days=10):
|
||||
if notification.date_sent < make_aware(datetime.now(), get_current_timezone()) - timedelta(days=notification_timeout):
|
||||
continue
|
||||
except:
|
||||
InvoiceNotificationEmaxil.objects.create(invoice_number=invoice.id)
|
||||
|
|
|
@ -163,6 +163,7 @@ INVOICES_DIR = os.environ.get('INVOICES_DIR', os.path.dirname(__file__))
|
|||
INVOICES_MAIL_DIR = os.environ.get('INVOICES_MAIL_DIR', os.path.dirname(__file__))
|
||||
INVOICES_LOCATION_PATTERN = os.path.join(INVOICES_DIR, 'facture_{invoice_id}.pdf')
|
||||
INVOICES_MAIL_LOCATION_PATTERN = os.path.join(INVOICES_MAIL_DIR, 'tipi', 'facture_{invoice_id}.json')
|
||||
INVOICES_NOTIFICATION_TIMEOUT = os.environ.get('INVOICES_NOTIFICATION_TIMEOUT', 10) # in days
|
||||
|
||||
try:
|
||||
from local_settings import *
|
||||
|
|
Reference in New Issue