]> err.no Git - peojumk/commitdiff
Only display overdue warning when invoice is not paid
authorTollef Fog Heen <tfheen@err.no>
Wed, 1 Aug 2012 18:32:08 +0000 (20:32 +0200)
committerTollef Fog Heen <tfheen@err.no>
Wed, 1 Aug 2012 18:32:08 +0000 (20:32 +0200)
invoice/views.py

index 64a0f55201e67f7ab2a65d354af1d8528492313b..c1b2d6950b2cee06f9f139c866e7fa72c300b88c 100644 (file)
@@ -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