mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Invoices: Allow issuing invoices only to businesses (Z#23220397) (#5807)
* Invoices: Allow issuing invoices only to businesses In situations where every invoice has a significant accounting cost and consumers usually do not need invoices, this can save a lot of money or effort. * Improve backend UI if not qualified for invoice
This commit is contained in:
@@ -509,9 +509,10 @@ class OrderView(EventPermissionRequiredMixin, DetailView):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
ctx['can_generate_invoice'] = invoice_qualified(self.order) and (
|
||||
ctx['invoice_qualified'] = invoice_qualified(self.order)
|
||||
ctx['can_generate_invoice'] = ctx['invoice_qualified'] and (
|
||||
self.request.event.settings.invoice_generate in ('admin', 'user', 'paid', 'user_paid', 'True')
|
||||
) and self.order.status in (Order.STATUS_PAID, Order.STATUS_PENDING) and (
|
||||
) and (
|
||||
not self.order.invoices.exists()
|
||||
or self.order.invoices.filter(is_cancellation=True).count() >= self.order.invoices.filter(is_cancellation=False).count()
|
||||
)
|
||||
@@ -1742,14 +1743,15 @@ class OrderInvoiceReissue(OrderView):
|
||||
messages.error(self.request, _('The invoice has been cleaned of personal data.'))
|
||||
else:
|
||||
c = generate_cancellation(inv)
|
||||
if order.status not in (Order.STATUS_CANCELED, Order.STATUS_EXPIRED):
|
||||
if invoice_qualified(order):
|
||||
inv = generate_invoice(order)
|
||||
messages.success(self.request, _('The invoice has been reissued.'))
|
||||
else:
|
||||
inv = c
|
||||
messages.success(self.request, _('The invoice has been canceled.'))
|
||||
order.log_action('pretix.event.order.invoice.reissued', user=self.request.user, data={
|
||||
'invoice': inv.pk
|
||||
})
|
||||
messages.success(self.request, _('The invoice has been reissued.'))
|
||||
return redirect(self.get_order_url())
|
||||
|
||||
def get(self, *args, **kwargs): # NOQA
|
||||
|
||||
Reference in New Issue
Block a user