some fix to wallets

remotes/origin/PR-39
PekopT 10 years ago
parent c0504caa0e
commit 2e8d991ff4
  1. 4
      wallets/signals.py
  2. 2
      wallets/views.py

@ -21,12 +21,12 @@ def send_for_accountant(sender, instance, created, **kwargs):
@receiver(post_save, sender=Transaction) @receiver(post_save, sender=Transaction)
def add_invoice_history(sender, instance,created, **kwargs): def add_invoice_history(sender, instance, created, **kwargs):
if 'add' in instance.type: if 'add' in instance.type:
inv_history = InvoiceHistory() inv_history = InvoiceHistory()
inv_history.comment = 'Пополнение счета' inv_history.comment = 'Пополнение счета'
inv_history.sum = instance.sum inv_history.sum = instance.sum
inv_history.user = instance.user inv_history.user = instance.customer
inv_history.save() inv_history.save()

@ -40,7 +40,7 @@ class ScoreView(View):
return HttpResponseForbidden('403 Forbidden') return HttpResponseForbidden('403 Forbidden')
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
transaction = Transaction.objects.create(customer=request.user) transaction = Transaction.objects.get_or_create(customer=request.user, complete=False)
user_score = get_object_or_404(User.customer_objects, pk=kwargs.get('pk')) user_score = get_object_or_404(User.customer_objects, pk=kwargs.get('pk'))
return render(request, self.template_name, { return render(request, self.template_name, {

Loading…
Cancel
Save