Fix bugs from unreporting printer transactions
This commit is contained in:
parent
b9c8fd5b4c
commit
42fa0f1844
|
@ -72,7 +72,7 @@ class Transaction(models.Model):
|
|||
member_id = models.IntegerField(blank=True, null=True)
|
||||
date = models.DateField(default=today_alberta_tz)
|
||||
amount = models.DecimalField(max_digits=7, decimal_places=2)
|
||||
reference_number = models.CharField(max_length=32, blank=True, null=True)
|
||||
reference_number = models.CharField(max_length=64, blank=True, null=True)
|
||||
memo = models.TextField(blank=True, null=True)
|
||||
number_of_membership_months = models.IntegerField(blank=True, null=True)
|
||||
payment_method = models.TextField(blank=True, null=True)
|
||||
|
|
|
@ -158,7 +158,8 @@ class TransactionSerializer(serializers.ModelSerializer):
|
|||
current_protocoin = (user.transactions.aggregate(Sum('protocoin'))['protocoin__sum'] or 0) - instance.protocoin
|
||||
new_protocoin = current_protocoin + validated_data['protocoin']
|
||||
if new_protocoin < 0:
|
||||
raise ValidationError(dict(category='Insufficient funds. Member only had {} protocoin.'.format(current_protocoin)))
|
||||
msg = 'Negative Protocoin transaction updated:\n' + str(validated_data)
|
||||
utils.alert_tanner(msg)
|
||||
|
||||
return super().update(instance, validated_data)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user