Attempt to show relevant lines when we have more than 1 line item

This commit is contained in:
PCoder 2019-04-20 15:20:55 +02:00
commit e782d27739
2 changed files with 81 additions and 68 deletions

View file

@ -1322,6 +1322,9 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView):
context['total_in_chf'] = obj.total_in_chf()
context['invoice_number'] = obj.invoice_number
context['discount_on_stripe'] = obj.discount_in_chf()
if obj.lines_data_count > 1:
# special case, we pass the details of each of the line items
context['line_items'] = obj.hostingbilllineitem_set.all()
return context
else:
raise Http404