Allow to add a text to gift card transactions

This commit is contained in:
Raphael Michel
2020-03-02 12:47:39 +01:00
parent 1539eea664
commit 381fa5e1cd
6 changed files with 80 additions and 41 deletions

View File

@@ -1010,12 +1010,14 @@ class GiftCardDetailView(OrganizerDetailViewMixin, OrganizerPermissionRequiredMi
messages.error(request, _('Gift cards are not allowed to have negative values.'))
else:
self.object.transactions.create(
value=value
value=value,
text=request.POST.get('text') or None,
)
self.object.log_action(
'pretix.giftcards.transaction.manual',
data={
'value': value
'value': value,
'text': request.POST.get('text')
},
user=self.request.user,
)