forked from CGM_Public/pretix_original
Invoice name in order list
This commit is contained in:
@@ -70,14 +70,17 @@
|
||||
<th>{% trans "User" %}
|
||||
<a href="?{% url_replace request 'ordering' '-email' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'email' %}"><i class="fa fa-caret-up"></i></a></th>
|
||||
<th>{% trans "Order total" %}
|
||||
<a href="?{% url_replace request 'ordering' '-total' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'total' %}"><i class="fa fa-caret-up"></i></a></th>
|
||||
<th>{% trans "Order date" %}
|
||||
<a href="?{% url_replace request 'ordering' '-datetime' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'datetime' %}"><i class="fa fa-caret-up"></i></a>
|
||||
</th>
|
||||
<th>{% trans "Status" %}
|
||||
<th class="text-right">{% trans "Order total" %}
|
||||
<a href="?{% url_replace request 'ordering' '-total' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'total' %}"><i class="fa fa-caret-up"></i></a></th>
|
||||
<th class="text-right">{% trans "Positions" %}
|
||||
<a href="?{% url_replace request 'ordering' '-pcnt' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'pcnt' %}"><i class="fa fa-caret-up"></i></a></th>
|
||||
<th class="text-right">{% trans "Status" %}
|
||||
<a href="?{% url_replace request 'ordering' '-status' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'status' %}"><i class="fa fa-caret-up"></i></a></th>
|
||||
</tr>
|
||||
@@ -88,10 +91,16 @@
|
||||
<td><strong><a
|
||||
href="{% url "control:event.order" event=request.event.slug organizer=request.event.organizer.slug code=o.code %}"
|
||||
>{{ o.code }}</a></strong></td>
|
||||
<td>{{ o.email }}</td>
|
||||
<td>{{ o.total|floatformat:2 }} {{ request.event.currency }}</td>
|
||||
<td>
|
||||
{{ o.email }}
|
||||
{% if o.invoice_address.name %}
|
||||
<br>{{ o.invoice_address.name }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ o.datetime|date:"SHORT_DATETIME_FORMAT" }}</td>
|
||||
<td>{% include "pretixcontrol/orders/fragment_order_status.html" with order=o %}</td>
|
||||
<td class="text-right">{{ o.total|floatformat:2 }} {{ request.event.currency }}</td>
|
||||
<td class="text-right">{{ o.pcnt }}</td>
|
||||
<td class="text-right">{% include "pretixcontrol/orders/fragment_order_status.html" with order=o %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
@@ -38,13 +38,16 @@
|
||||
<th>{% trans "User" %}
|
||||
<a href="?{% url_replace request 'ordering' '-email' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'email' %}"><i class="fa fa-caret-up"></i></a></th>
|
||||
<th>{% trans "Order total" %}
|
||||
<a href="?{% url_replace request 'ordering' '-total' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'total' %}"><i class="fa fa-caret-up"></i></a></th>
|
||||
<th>{% trans "Order date" %}
|
||||
<a href="?{% url_replace request 'ordering' '-datetime' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'datetime' %}"><i class="fa fa-caret-up"></i></a></th>
|
||||
<th>{% trans "Status" %}
|
||||
<th class="text-right">{% trans "Order total" %}
|
||||
<a href="?{% url_replace request 'ordering' '-total' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'total' %}"><i class="fa fa-caret-up"></i></a></th>
|
||||
<th class="text-right">{% trans "Positions" %}
|
||||
<a href="?{% url_replace request 'ordering' '-pcnt' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'pcnt' %}"><i class="fa fa-caret-up"></i></a></th>
|
||||
<th class="text-right">{% trans "Status" %}
|
||||
<a href="?{% url_replace request 'ordering' '-status' %}"><i class="fa fa-caret-down"></i></a>
|
||||
<a href="?{% url_replace request 'ordering' 'status' %}"><i class="fa fa-caret-up"></i></a></th>
|
||||
</tr>
|
||||
@@ -60,10 +63,16 @@
|
||||
</strong>
|
||||
</td>
|
||||
<td>{{ o.event.name }}</td>
|
||||
<td>{{ o.email }}</td>
|
||||
<td>{{ o.total|floatformat:2 }} {{ o.event.currency }}</td>
|
||||
<td>
|
||||
{{ o.email }}
|
||||
{% if o.invoice_address.name %}
|
||||
<br>{{ o.invoice_address.name }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ o.datetime|date:"SHORT_DATETIME_FORMAT" }}</td>
|
||||
<td>{% include "pretixcontrol/orders/fragment_order_status.html" with order=o %}</td>
|
||||
<td class="text-right">{{ o.total|floatformat:2 }} {{ o.event.currency }}</td>
|
||||
<td class="text-right">{{ o.pcnt }}</td>
|
||||
<td class="text-right">{% include "pretixcontrol/orders/fragment_order_status.html" with order=o %}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
|
||||
@@ -3,6 +3,7 @@ from datetime import timedelta
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db.models import Count
|
||||
from django.http import FileResponse, Http404, HttpResponseNotAllowed
|
||||
from django.shortcuts import redirect, render
|
||||
from django.utils.functional import cached_property
|
||||
@@ -49,13 +50,14 @@ class OrderList(EventPermissionRequiredMixin, ListView):
|
||||
def get_queryset(self):
|
||||
qs = Order.objects.filter(
|
||||
event=self.request.event
|
||||
)
|
||||
).annotate(pcnt=Count('positions')).select_related('invoice_address')
|
||||
if self.filter_form.is_valid():
|
||||
qs = self.filter_form.filter_qs(qs)
|
||||
|
||||
if self.request.GET.get("ordering", "") != "":
|
||||
p = self.request.GET.get("ordering", "")
|
||||
p_admissable = ('-code', 'code', '-email', 'email', '-total', 'total', '-datetime', 'datetime', '-status', 'status')
|
||||
p_admissable = ('-code', 'code', '-email', 'email', '-total', 'total', '-datetime', 'datetime',
|
||||
'-status', 'status', 'pcnt', '-pcnt')
|
||||
if p in p_admissable:
|
||||
qs = qs.order_by(p)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from django.db.models import Q
|
||||
from django.db.models import Count, Q
|
||||
from django.utils.functional import cached_property
|
||||
from django.views.generic import ListView
|
||||
|
||||
@@ -22,7 +22,7 @@ class OrderSearch(ListView):
|
||||
return ctx
|
||||
|
||||
def get_queryset(self):
|
||||
qs = Order.objects.all()
|
||||
qs = Order.objects.all().annotate(pcnt=Count('positions')).select_related('invoice_address')
|
||||
if not self.request.user.is_superuser:
|
||||
qs = qs.filter(
|
||||
Q(event__organizer_id__in=self.request.user.teams.filter(
|
||||
@@ -37,7 +37,7 @@ class OrderSearch(ListView):
|
||||
if self.request.GET.get("ordering", "") != "":
|
||||
p = self.request.GET.get("ordering", "")
|
||||
p_admissable = ('event', '-event', '-code', 'code', '-email', 'email', '-total', 'total', '-datetime',
|
||||
'datetime', '-status', 'status')
|
||||
'datetime', '-status', 'status', 'pcnt', '-pcnt')
|
||||
if p in p_admissable:
|
||||
qs = qs.order_by(p)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user