invoices which are not paied at all are emailed

Closes #4990
This commit is contained in:
Serghei Mihai 2014-06-19 11:50:19 +02:00
parent 234bae2b9f
commit bc98945412
1 changed files with 3 additions and 2 deletions

View File

@ -19,8 +19,9 @@ class Command(BaseCommand):
def handle(self, *args, **options):
for invoice in Facture.objects.filter(active=True, date_limite_paie__gte=datetime.now(),
famille__liaisonnameidfamille__isnull=False, paye=False):
for invoice in Facture.objects.filter(Q(paye=False) | Q(montant_regle=0),
active=True, date_limite_paie__gte=datetime.now(),
famille__liaisonnameidfamille__isnull=False):
try:
notification = InvoiceNotificationEmail.objects.filter(invoice_number=invoice.id).latest()
if notification.date_sent > make_aware(datetime.now(), get_current_timezone()) - timedelta(days=notification_timeout):