forked from CGM_Public/pretix_original
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 = build_invoice(invoice)
|
||||||
invoice_pdf(invoice.pk)
|
invoice_pdf(invoice.pk)
|
||||||
|
|
||||||
|
if order.status in (Order.STATUS_CANCELED, Order.STATUS_REFUNDED):
|
||||||
|
generate_cancellation(invoice)
|
||||||
|
|
||||||
return 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 %}">
|
action="{% url "control:event.order.reissueinvoice" event=request.event.slug organizer=request.event.organizer.slug code=order.code id=i.pk %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<button class="btn btn-default btn-xs">
|
<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>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -366,8 +366,11 @@ class OrderInvoiceReissue(OrderView):
|
|||||||
if inv.canceled:
|
if inv.canceled:
|
||||||
messages.error(self.request, _('The invoice has already been canceled.'))
|
messages.error(self.request, _('The invoice has already been canceled.'))
|
||||||
else:
|
else:
|
||||||
generate_cancellation(inv)
|
c = generate_cancellation(inv)
|
||||||
inv = generate_invoice(self.order)
|
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={
|
self.order.log_action('pretix.event.order.invoice.reissued', user=self.request.user, data={
|
||||||
'invoice': inv.pk
|
'invoice': inv.pk
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user