mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Fix invoice duplication when importing payments for expired orders
This commit is contained in:
@@ -203,7 +203,7 @@ def build_cancellation(invoice: Invoice):
|
||||
|
||||
|
||||
def generate_cancellation(invoice: Invoice, trigger_pdf=True):
|
||||
if invoice.refered.exists():
|
||||
if invoice.canceled:
|
||||
raise ValueError("Invoice should not be canceled twice.")
|
||||
cancellation = modelcopy(invoice)
|
||||
cancellation.pk = None
|
||||
|
||||
@@ -1753,7 +1753,7 @@ def change_payment_provider(order: Order, payment_provider, amount=None, new_pay
|
||||
|
||||
if recreate_invoices:
|
||||
i = order.invoices.filter(is_cancellation=False).last()
|
||||
if i and order.total != oldtotal:
|
||||
if i and order.total != oldtotal and not i.canceled:
|
||||
generate_cancellation(i)
|
||||
generate_invoice(order)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user