Simplify showing total price

This commit is contained in:
PCoder 2019-04-03 23:54:52 +02:00
parent f1a7958f03
commit baf62f1924
2 changed files with 6 additions and 6 deletions

View file

@ -139,8 +139,7 @@
<p> <p>
<small>{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) <small>{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%)
</small> </small>
<strong class="pull-right">{{vm.vat|floatformat:2|intcomma}} <strong class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</strong>
CHF</strong>
</p> </p>
{% endif %} {% endif %}
{% if vm.discount.amount > 0 %} {% if vm.discount.amount > 0 %}
@ -159,8 +158,7 @@
<div class="col-sm-6"> <div class="col-sm-6">
<p class="total-price"> <p class="total-price">
<strong>{% trans "Total" %} </strong> <strong>{% trans "Total" %} </strong>
<strong class="pull-right">{% if vm.total_price %}{{vm.total_price|floatformat:2|intcomma}}{% else %}{{vm.price|floatformat:2|intcomma}}{% endif %} <strong class="pull-right">{{total_in_chf}} CHF</strong>
CHF</strong>
</p> </p>
</div> </div>
</div> </div>

View file

@ -1173,7 +1173,9 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView):
def get_object(self, queryset=None): def get_object(self, queryset=None):
invoice_id = self.kwargs.get('invoice_id') invoice_id = self.kwargs.get('invoice_id')
try: 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( logger.debug("Found MHB for id {invoice_id}".format(
invoice_id=invoice_id invoice_id=invoice_id
)) ))
@ -1184,7 +1186,7 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView):
else: else:
logger.error("User does not have permission to access") logger.error("User does not have permission to access")
invoice_obj = None invoice_obj = None
except MonthlyHostingBill.DoesNotExist: except MonthlyHostingBill.DoesNotExist as dne:
logger.debug("MHB not found for id {invoice_id}".format( logger.debug("MHB not found for id {invoice_id}".format(
invoice_id=invoice_id invoice_id=invoice_id
)) ))