Refactor cancelling positions and orders in the data model (#1088)

- [x] Data model
- [x] display in order view in backend
- [x] review all usages of OrderPositions.objects
- [x] review all usages of order.positions
- [x] review all other model usages
- [x] review plugins
- [x] plugins backwards-compatible API?
- [x] decide on way forward for REST API
- [x] need to cancel fees
- [x] tests
- [ ] plugins
  - [ ] gdpr
  - [ ] reports
- [x] docs
This commit is contained in:
Raphael Michel
2019-01-10 16:52:34 +01:00
committed by GitHub
parent 588955901c
commit 8abfbba9d0
41 changed files with 579 additions and 351 deletions

View File

@@ -7,11 +7,13 @@
<span class="label label-warning {{ class }}">{% trans "Pending" %}</span>
{% endif %}
{% elif order.status == "p" %}
<span class="label label-success {{ class }}">{% trans "Paid" %}</span>
{% if order.count_positions == 0 %}
<span class="label label-info {{ class }}">{% trans "Canceled (paid fee)" %}</span>
{% else %}
<span class="label label-success {{ class }}">{% trans "Paid" %}</span>
{% endif %}
{% elif order.status == "e" %} {# expired #}
<span class="label label-danger {{ class }}">{% trans "Expired" %}</span>
{% elif order.status == "c" %}
<span class="label label-danger {{ class }}">{% trans "Canceled" %}</span>
{% elif order.status == "r" %}
<span class="label label-danger {{ class }}">{% trans "Refunded" %}</span>
{% endif %}

View File

@@ -142,7 +142,7 @@
{% endif %}
{{ o.total|money:request.event.currency }}
</td>
<td class="text-right">{{ o.pcnt }}</td>
<td class="text-right">{{ o.pcnt|default_if_none:"0" }}</td>
<td class="text-right">{% include "pretixcontrol/orders/fragment_order_status.html" with order=o %}</td>
</tr>
{% endfor %}

View File

@@ -30,8 +30,7 @@
<thead>
<tr>
<th>{% trans "Product" %}</th>
<th>{% trans "Canceled" %}</th>
<th>{% trans "Refunded" %}</th>
<th>{% trans "Canceled" %}¹</th>
<th>{% trans "Expired" %}</th>
<th colspan="3">{% trans "Purchased" %}</th>
</tr>
@@ -39,7 +38,6 @@
<th></th>
<th></th>
<th></th>
<th></th>
<th>{% trans "Pending" %}</th>
<th>{% trans "Paid" %}</th>
<th>{% trans "Total" %}</th>
@@ -51,7 +49,6 @@
<tr class="category">
<th>{{ tup.0 }}</th>
<th>{{ tup.0.num.canceled|togglesum:request.event.currency }}</th>
<th>{{ tup.0.num.refunded|togglesum:request.event.currency }}</th>
<th>{{ tup.0.num.expired|togglesum:request.event.currency }}</th>
<th>{{ tup.0.num.pending|togglesum:request.event.currency }}</th>
<th>{{ tup.0.num.paid|togglesum:request.event.currency }}</th>
@@ -66,11 +63,6 @@
{{ item.num.canceled|togglesum:request.event.currency }}
</a>
</td>
<td>
<a href="{{ listurl }}?item={{ item.id }}&amp;status=r&amp;provider={{ item.provider }}">
{{ item.num.refunded|togglesum:request.event.currency }}
</a>
</td>
<td>
<a href="{{ listurl }}?item={{ item.id }}&amp;status=e&amp;provider={{ item.provider }}">
{{ item.num.expired|togglesum:request.event.currency }}
@@ -95,7 +87,6 @@
<tr class="variation {% if tup.0 %}categorized{% endif %}">
<td>{{ var }}</td>
<td>{{ var.num.canceled|togglesum:request.event.currency }}</td>
<td>{{ var.num.refunded|togglesum:request.event.currency }}</td>
<td>{{ var.num.expired|togglesum:request.event.currency }}</td>
<td>{{ var.num.pending|togglesum:request.event.currency }}</td>
<td>{{ var.num.paid|togglesum:request.event.currency }}</td>
@@ -110,7 +101,6 @@
<tr class="total">
<th>{% trans "Total" %}</th>
<th>{{ total.num.canceled|togglesum:request.event.currency }}</th>
<th>{{ total.num.refunded|togglesum:request.event.currency }}</th>
<th>{{ total.num.expired|togglesum:request.event.currency }}</th>
<th>{{ total.num.pending|togglesum:request.event.currency }}</th>
<th>{{ total.num.paid|togglesum:request.event.currency }}</th>
@@ -119,4 +109,7 @@
</tfoot>
</table>
</div>
<p class="help-block">
¹ {% trans "If you click links in this column, you will only find orders that are canceled completely, while the numbers also include single canceled positions within valid orders." %}
</p>
{% endblock %}