Fix order split with add-ons involved (#2513)

This commit is contained in:
Raphael Michel
2022-03-03 16:54:20 +01:00
committed by GitHub
parent d796c399a6
commit 4e2a3b45da
5 changed files with 41 additions and 3 deletions

View File

@@ -482,6 +482,9 @@ class OrderPositionChangeForm(forms.Form):
self.fields['tax_rule'].queryset = instance.event.tax_rules.all()
self.fields['tax_rule'].label_from_instance = self.taxrule_label_from_instance
if instance.addon_to_id:
del self.fields['operation_split']
if not instance.seat and not (
instance.item.seat_category_mappings.filter(subevent=instance.subevent).exists()
):

View File

@@ -202,10 +202,12 @@
</div>
{% bootstrap_field position.form.operation_cancel layout='inline' %}
{% bootstrap_field position.form.operation_split layout='inline' %}
{% if position.form.operation_split %}
{% bootstrap_field position.form.operation_split layout='inline' %}
{% endif %}
{% if position.addons.exists %}
<em class="text-danger">
{% trans "Removing this position will also remove all add-ons to this position." %}
{% trans "Removing or splitting this position will also remove or split all add-ons to this position." %}
</em>
{% endif %}
</div>

View File

@@ -1760,7 +1760,7 @@ class OrderChange(OrderView):
if p.form.cleaned_data['tax_rule'] and p.form.cleaned_data['tax_rule'] != p.tax_rule:
ocm.change_tax_rule(p, p.form.cleaned_data['tax_rule'])
if p.form.cleaned_data['operation_split']:
if p.form.cleaned_data.get('operation_split'):
ocm.split(p)
if p.form.cleaned_data['operation_secret']: