From baf62f1924c4079bb01bbb8fb0d629223fdd4661 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 3 Apr 2019 23:54:52 +0200 Subject: [PATCH] Simplify showing total price --- hosting/templates/hosting/invoice_detail.html | 6 ++---- hosting/views.py | 6 ++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hosting/templates/hosting/invoice_detail.html b/hosting/templates/hosting/invoice_detail.html index 9c300b3f..80226123 100644 --- a/hosting/templates/hosting/invoice_detail.html +++ b/hosting/templates/hosting/invoice_detail.html @@ -139,8 +139,7 @@

{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) - {{vm.vat|floatformat:2|intcomma}} - CHF + {{vm.vat|floatformat:2|intcomma}} CHF

{% endif %} {% if vm.discount.amount > 0 %} @@ -159,8 +158,7 @@

{% trans "Total" %} - {% if vm.total_price %}{{vm.total_price|floatformat:2|intcomma}}{% else %}{{vm.price|floatformat:2|intcomma}}{% endif %} - CHF + {{total_in_chf}} CHF

diff --git a/hosting/views.py b/hosting/views.py index 34e720f6..af01ae86 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -1173,7 +1173,9 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView): def get_object(self, queryset=None): invoice_id = self.kwargs.get('invoice_id') try: - invoice_obj = MonthlyHostingBill.objects.get(invoice_number=invoice_id) + invoice_obj = MonthlyHostingBill.objects.get( + invoice_number=invoice_id + ) logger.debug("Found MHB for id {invoice_id}".format( invoice_id=invoice_id )) @@ -1184,7 +1186,7 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView): else: logger.error("User does not have permission to access") invoice_obj = None - except MonthlyHostingBill.DoesNotExist: + except MonthlyHostingBill.DoesNotExist as dne: logger.debug("MHB not found for id {invoice_id}".format( invoice_id=invoice_id ))