Fix involuntarily created invoices

This commit is contained in:
Raphael Michel
2018-11-21 13:07:28 +01:00
parent f34c528cba
commit 0f76779fb1

View File

@@ -107,7 +107,8 @@ def extend_order(order: Order, new_date: datetime, force: bool=False, user: User
}
)
if was_expired:
if order.invoices.filter(is_cancellation=True).count() >= order.invoices.filter(is_cancellation=False).count():
num_invoices = order.invoices.filter(is_cancellation=False).count()
if num_invoices > 0 and order.invoices.filter(is_cancellation=True).count() >= num_invoices:
generate_invoice(order)
if order.status == Order.STATUS_PENDING: