forked from CGM_Public/pretix_original
Refunds in state "done" should always have an execution date
This commit is contained in:
@@ -2143,6 +2143,12 @@ class OrderRefund(models.Model):
|
||||
self.local_id = (self.order.refunds.aggregate(m=Max('local_id'))['m'] or 0) + 1
|
||||
if 'update_fields' in kwargs:
|
||||
kwargs['update_fields'] = {'local_id'}.union(kwargs['update_fields'])
|
||||
|
||||
if self.state == OrderRefund.REFUND_STATE_DONE and not self.execution_date:
|
||||
self.execution_date = now()
|
||||
if 'update_fields' in kwargs:
|
||||
kwargs['update_fields'] = {'execution_date'}.union(kwargs['update_fields'])
|
||||
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
|
||||
@@ -1677,6 +1677,7 @@ def test_refund_create_webhook_sent(token_client, organizer, event, order):
|
||||
assert r.provider == "manual"
|
||||
assert r.amount == Decimal("23.00")
|
||||
assert r.state == "done"
|
||||
assert r.execution_date
|
||||
with scopes_disabled():
|
||||
assert order.all_logentries().get(action_type="pretix.event.order.refund.done")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user