forked from CGM_Public/pretix_original
* Fix #339 -- Allow to split orders * Add tests for split orders * Add notificatiosn to both users * Improve logdisplay
This commit is contained in:
@@ -187,7 +187,8 @@ class OrderPositionChangeForm(forms.Form):
|
||||
('product', 'Change product'),
|
||||
('price', 'Change price'),
|
||||
('subevent', 'Change event date'),
|
||||
('cancel', 'Remove product')
|
||||
('cancel', 'Remove product'),
|
||||
('split', 'Split into new order'),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -85,6 +85,21 @@ def _display_order_changed(event: Event, logentry: LogEntry):
|
||||
price=formats.localize(Decimal(data['price'])),
|
||||
currency=event.currency
|
||||
)
|
||||
elif logentry.action_type == 'pretix.event.order.changed.split':
|
||||
old_item = str(event.items.get(pk=data['old_item']))
|
||||
if data['old_variation']:
|
||||
old_item += ' - ' + str(ItemVariation.objects.get(pk=data['old_variation']))
|
||||
return text + ' ' + _('Position #{posid} ({old_item}, {old_price} {currency}) split into new order: {order}').format(
|
||||
old_item=old_item,
|
||||
posid=data.get('positionid', '?'),
|
||||
order=data['new_order'],
|
||||
old_price=formats.localize(Decimal(data['old_price'])),
|
||||
currency=event.currency
|
||||
)
|
||||
elif logentry.action_type == 'pretix.event.order.changed.split_from':
|
||||
return _('This order has been created by splitting the order {order}').format(
|
||||
order=data['original_order'],
|
||||
)
|
||||
|
||||
|
||||
@receiver(signal=logentry_display, dispatch_uid="pretixcontrol_logentry_display")
|
||||
|
||||
@@ -36,6 +36,12 @@
|
||||
If an invoice is attached to the order, a cancellation will be created together with a new invoice.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
If you chose "split into new order" for multiple positions, they will be all split in one second order
|
||||
together, not multiple orders.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<div class="alert alert-warning"><strong>
|
||||
{% blocktrans trimmed %}
|
||||
Please use this tool carefully. Changes you make here are not reversible. Also, if you change an order
|
||||
@@ -118,6 +124,13 @@
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input name="{{ position.form.prefix }}-operation" type="radio" value="split"
|
||||
{% if position.form.operation.value == "split" %}checked="checked"{% endif %}>
|
||||
{% trans "Split into new order" %}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input name="{{ position.form.prefix }}-operation" type="radio" value="cancel"
|
||||
|
||||
@@ -593,6 +593,8 @@ class OrderChange(OrderView):
|
||||
ocm.change_subevent(p, p.form.cleaned_data['subevent'])
|
||||
elif p.form.cleaned_data['operation'] == 'cancel':
|
||||
ocm.cancel(p)
|
||||
elif p.form.cleaned_data['operation'] == 'split':
|
||||
ocm.split(p)
|
||||
|
||||
except OrderError as e:
|
||||
p.custom_error = str(e)
|
||||
|
||||
Reference in New Issue
Block a user