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