Fix #258 -- Add a comment field to bank transactions

This commit is contained in:
Raphael Michel
2016-10-08 20:18:35 +02:00
parent 166fedb4ef
commit d43d6f485b
6 changed files with 104 additions and 1 deletions

View File

@@ -99,6 +99,13 @@ class ActionView(EventPermissionRequiredMixin, View):
else:
return self._retry(trans)
def _comment(self, trans, comment):
trans.comment = comment
trans.save()
return JsonResponse({
'status': 'ok'
})
def post(self, request, *args, **kwargs):
for k, v in request.POST.items():
if not k.startswith('action_'):
@@ -113,6 +120,9 @@ class ActionView(EventPermissionRequiredMixin, View):
# Accept anyway even with wrong amount
return self._accept_ignore_amount(trans)
elif v.startswith('comment:'):
return self._comment(trans, v[8:])
elif v.startswith('assign:') and trans.state == BankTransaction.STATE_NOMATCH:
return self._assign(trans, v[7:])