mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Add safeguards and tests against duplicate cancellations
This commit is contained in:
@@ -210,6 +210,8 @@ def build_cancellation(invoice: Invoice):
|
||||
|
||||
|
||||
def generate_cancellation(invoice: Invoice, trigger_pdf=True):
|
||||
if invoice.refered.exists():
|
||||
raise ValueError("Invoice should not be canceled twice.")
|
||||
cancellation = modelcopy(invoice)
|
||||
cancellation.pk = None
|
||||
cancellation.invoice_no = None
|
||||
|
||||
Reference in New Issue
Block a user