Fix #339 -- Allow to split orders (#341)

* Fix #339 -- Allow to split orders

* Add tests for split orders

* Add notificatiosn to both users

* Improve logdisplay
This commit is contained in:
Raphael Michel
2017-10-30 23:15:53 +01:00
committed by GitHub
parent 429f30fca7
commit 71a4664d1f
7 changed files with 461 additions and 29 deletions

View File

@@ -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")