Order change: Allow to keep price when changing items

This commit is contained in:
Raphael Michel
2019-02-11 16:15:13 +01:00
parent d9d1c83218
commit d073007fd7
5 changed files with 25 additions and 4 deletions

View File

@@ -286,6 +286,7 @@ class OrderPositionChangeForm(forms.Form):
('secret', 'Regenerate secret'),
)
)
change_product_keep_price = forms.BooleanField(required=False)
def __init__(self, *args, **kwargs):
instance = kwargs.pop('instance')

View File

@@ -95,6 +95,10 @@
{% trans "Change product to" %}
{% bootstrap_field position.form.itemvar layout='inline' %}
</label>
<label class="checkbox">
{{ position.form.change_product_keep_price }}
{% trans "Keep price the same" %}
</label>
</div>
{% if request.event.has_subevents %}
<div class="radio">

View File

@@ -1229,7 +1229,7 @@ class OrderChange(OrderView):
variation = ItemVariation.objects.get(pk=varid, item=item)
else:
variation = None
ocm.change_item(p, item, variation)
ocm.change_item(p, item, variation, keep_price=p.form.cleaned_data['change_product_keep_price'])
elif p.form.cleaned_data['operation'] == 'price':
ocm.change_price(p, p.form.cleaned_data['price'])
elif p.form.cleaned_data['operation'] == 'subevent':