Refactor cancelling positions and orders in the data model (#1088)

- [x] Data model
- [x] display in order view in backend
- [x] review all usages of OrderPositions.objects
- [x] review all usages of order.positions
- [x] review all other model usages
- [x] review plugins
- [x] plugins backwards-compatible API?
- [x] decide on way forward for REST API
- [x] need to cancel fees
- [x] tests
- [ ] plugins
  - [ ] gdpr
  - [ ] reports
- [x] docs
This commit is contained in:
Raphael Michel
2019-01-10 16:52:34 +01:00
committed by GitHub
parent 588955901c
commit 8abfbba9d0
41 changed files with 579 additions and 351 deletions

View File

@@ -740,7 +740,7 @@ class OrderTestCase(BaseQuotaTestCase):
q = Question.objects.create(question='Foo', type=Question.TYPE_BOOLEAN, event=self.event)
self.item1.questions.add(q)
assert self.order.can_modify_answers
self.order.status = Order.STATUS_REFUNDED
self.order.status = Order.STATUS_CANCELED
assert not self.order.can_modify_answers
self.order.status = Order.STATUS_PAID
assert self.order.can_modify_answers
@@ -963,7 +963,7 @@ class OrderTestCase(BaseQuotaTestCase):
assert o.has_external_refund
def test_pending_order_pending_refund(self):
self.order.status = Order.STATUS_REFUNDED
self.order.status = Order.STATUS_CANCELED
self.order.save()
self.order.payments.create(
amount=Decimal('46.00'),
@@ -1023,6 +1023,14 @@ class OrderTestCase(BaseQuotaTestCase):
assert not o.has_pending_refund
assert not o.has_external_refund
def test_canceled_positions(self):
self.op1.canceled = True
self.op1.save()
assert OrderPosition.objects.count() == 1
assert OrderPosition.all.count() == 2
assert self.order.positions.count() == 1
assert self.order.all_positions.count() == 2
class ItemCategoryTest(TestCase):
"""