Order change: Allow to ignore quotas

This commit is contained in:
Raphael Michel
2019-02-11 16:15:54 +01:00
parent d073007fd7
commit f23de7e2c0
5 changed files with 19 additions and 3 deletions

View File

@@ -177,6 +177,10 @@ class OtherOperationsForm(forms.Form):
'Send an email to the customer notifying that their order has been changed.'
)
)
ignore_quotas = forms.BooleanField(
label=_('Allow to overbook quotas when performing this operation'),
required=False,
)
def __init__(self, *args, **kwargs):
kwargs.pop('order')

View File

@@ -206,6 +206,9 @@
</div>
</div>
</div>
<div class="">
{% bootstrap_field other_form.ignore_quotas layout="" %}
</div>
<div class="form-group submit-group">
<a class="btn btn-default btn-lg"
href="{% url "control:event.order" event=request.event.slug organizer=request.event.organizer.slug code=order.code %}">

View File

@@ -1259,7 +1259,7 @@ class OrderChange(OrderView):
messages.error(self.request, _('An error occurred. Please see the details below.'))
else:
try:
ocm.commit()
ocm.commit(check_quotas=not self.other_form.cleaned_data['ignore_quotas'])
except OrderError as e:
messages.error(self.request, str(e))
else: