mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Fix #585 -- Creating invoices for refunded orders
This commit is contained in:
@@ -191,6 +191,10 @@ def generate_invoice(order: Order):
|
||||
)
|
||||
invoice = build_invoice(invoice)
|
||||
invoice_pdf(invoice.pk)
|
||||
|
||||
if order.status in (Order.STATUS_CANCELED, Order.STATUS_REFUNDED):
|
||||
generate_cancellation(invoice)
|
||||
|
||||
return invoice
|
||||
|
||||
|
||||
|
||||
@@ -131,7 +131,11 @@
|
||||
action="{% url "control:event.order.reissueinvoice" event=request.event.slug organizer=request.event.organizer.slug code=order.code id=i.pk %}">
|
||||
{% csrf_token %}
|
||||
<button class="btn btn-default btn-xs">
|
||||
{% trans "Cancel and reissue" %}
|
||||
{% if order.status == "r" or order.status == "c" %}
|
||||
{% trans "Generate cancellation" %}
|
||||
{% else %}
|
||||
{% trans "Cancel and reissue" %}
|
||||
{% endif %}
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
@@ -366,8 +366,11 @@ class OrderInvoiceReissue(OrderView):
|
||||
if inv.canceled:
|
||||
messages.error(self.request, _('The invoice has already been canceled.'))
|
||||
else:
|
||||
generate_cancellation(inv)
|
||||
inv = generate_invoice(self.order)
|
||||
c = generate_cancellation(inv)
|
||||
if self.order.status not in (Order.STATUS_CANCELED, Order.STATUS_REFUNDED):
|
||||
inv = generate_invoice(self.order)
|
||||
else:
|
||||
inv = c
|
||||
self.order.log_action('pretix.event.order.invoice.reissued', user=self.request.user, data={
|
||||
'invoice': inv.pk
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user