Make invoice for generic payment showable

This commit is contained in:
PCoder 2018-09-24 08:22:46 +02:00
parent d99271f71d
commit a90bec98ec
2 changed files with 132 additions and 106 deletions

View file

@ -39,7 +39,7 @@
{% endif %}
</span>
</p>
{% if order %}
{% if order and vm %}
<p>
<strong>{% trans "Status" %}: </strong>
<strong>
@ -93,6 +93,7 @@
<hr>
<div>
<h4>{% trans "Order summary" %}</h4>
{% if vm %}
<p>
<strong>{% trans "Product" %}:</strong>&nbsp;
{% if vm.name %}
@ -164,6 +165,25 @@
</p>
</div>
</div>
{% else %}
<div class="row">
<div class="col-sm-6">
<p>
<span>{% trans "Amount" %}: </span>
<strong class="pull-right">{{order.price|floatformat:2|intcomma}} CHF</strong>
</p>
{% if order.subscription_id %}
<p>
<span>{% trans "Recurring" %}: </span>
<strong class="pull-right">{{order.created_at|date:'d'|ordinal}} {% trans "of every month" %}</strong>
</p>
{% endif %}
</div>
<div class="col-sm-12">
<hr class="thin-hr">
</div>
</div>
{% endif %}
</div>
<hr class="thin-hr">
</div>

View file

@ -862,7 +862,13 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView):
raise Http404
if obj is not None:
if obj.generic_payment_id is not None:
# generic payment case
logger.debug("Generic payment case")
else:
# invoice for previous order
logger.debug("Invoice of VM order")
try:
vm_detail = VMDetail.objects.get(vm_id=obj.vm_id)
context['vm'] = vm_detail.__dict__