From: Tollef Fog Heen Date: Wed, 1 Aug 2012 18:32:08 +0000 (+0200) Subject: Only display overdue warning when invoice is not paid X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1380f3c571179f2835dbfc57bb8fe2288ffd41f4;p=peojumk Only display overdue warning when invoice is not paid --- diff --git a/invoice/views.py b/invoice/views.py index 64a0f55..c1b2d69 100644 --- a/invoice/views.py +++ b/invoice/views.py @@ -66,9 +66,10 @@ class DetailInvoice(DetailView): def get_context_data(self, *args, **kwargs): context_data = super(DetailInvoice, self).get_context_data(*args, **kwargs) - if self.object.due_days < 0: + + if self.object.due_days < 0 and self.object.status != 'P': context_data.update({'alert_error': "This invoice is overdue" }) - elif self.object.due_days < 3: + elif self.object.due_days < 3 and self.object.status != 'P': context_data.update({'alert_warning': "This invoice is soon due"}) return context_data