Fix club sellings

This commit is contained in:
Skia 2016-10-03 13:55:20 +02:00
parent 2ef5a4d37b
commit a12f9dd53e
2 changed files with 2 additions and 1 deletions

View File

@ -9,7 +9,7 @@
<p><input type="submit" value="{% trans %}Show{% endtrans %}" /></p>
</form>
<p>
{% trans %}Quantity: {% endtrans %}{{ result.count() }} {% trans %}units{% endtrans %}<br/>
{% trans %}Quantity: {% endtrans %}{{ total_quantity }} {% trans %}units{% endtrans %}<br/>
{% trans %}Total: {% endtrans %}{{ total }} €
</p>
<table>

View File

@ -196,6 +196,7 @@ class ClubSellingView(ClubTabsMixin, CanEditMixin, DetailView):
qs = qs.filter(product__id=form.cleaned_data['product'].id)
kwargs['result'] = qs.all().order_by('-id')
kwargs['total'] = sum([s.quantity * s.unit_price for s in qs.all()])
kwargs['total_quantity'] = sum([s.quantity for s in qs.all()])
else:
kwargs['result'] = qs[:0]
kwargs['form'] = form