forked from CGM_Public/pretix_original
OrderChangeManager: Prevent creation of 0 € invoices
This commit is contained in:
@@ -1725,7 +1725,8 @@ class OrderChangeManager:
|
||||
i = self.order.invoices.filter(is_cancellation=False).last()
|
||||
if self.reissue_invoice and i and self._invoice_dirty:
|
||||
self._invoices.append(generate_cancellation(i))
|
||||
self._invoices.append(generate_invoice(self.order))
|
||||
if invoice_qualified(self.order):
|
||||
self._invoices.append(generate_invoice(self.order))
|
||||
|
||||
def _check_complete_cancel(self):
|
||||
current = self.order.positions.count()
|
||||
|
||||
@@ -1393,6 +1393,15 @@ class OrderChangeManagerTests(TestCase):
|
||||
self.ocm.commit()
|
||||
assert self.order.invoices.count() == 3
|
||||
|
||||
@classscope(attr='o')
|
||||
def test_no_new_invoice_for_free_order(self):
|
||||
generate_invoice(self.order)
|
||||
assert self.order.invoices.count() == 1
|
||||
self.ocm.change_price(self.op1, Decimal('0.00'))
|
||||
self.ocm.change_price(self.op2, Decimal('0.00'))
|
||||
self.ocm.commit()
|
||||
assert self.order.invoices.count() == 2
|
||||
|
||||
@classscope(attr='o')
|
||||
def test_reissue_invoice_disabled(self):
|
||||
self.ocm.reissue_invoice = False
|
||||
|
||||
Reference in New Issue
Block a user