activating invoices when their generation date greater than today
This commit is contained in:
parent
cd94f93081
commit
9f4ef82dce
|
@ -1,7 +1,7 @@
|
|||
from os import path
|
||||
from datetime import date
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.db.models import get_model
|
||||
from django.conf import settings
|
||||
|
||||
from synchro_orleans.data.models import Facture
|
||||
|
@ -15,6 +15,7 @@ invoice is present the invoice becomes active and inactive if not."""
|
|||
|
||||
for invoice in Facture.objects.all():
|
||||
active = path.exists(settings.INVOICES_LOCATION_PATTERN.format(invoice_id = invoice.id))
|
||||
active = active and invoice.date_generation > date.today()
|
||||
|
||||
if active != invoice.active:
|
||||
invoice.active = active
|
||||
|
|
Reference in New Issue