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