Make it possible to refund VAT-less invoices
authorMagnus Hagander <magnus@hagander.net>
Wed, 24 Oct 2018 14:09:38 +0000 (15:09 +0100)
committerMagnus Hagander <magnus@hagander.net>
Wed, 24 Oct 2018 14:09:38 +0000 (15:09 +0100)
postgresqleu/invoices/forms.py

index 8917ec09cbf4790ee3638feb835b2029c3023547..256d2306b3ad6d6e78c487a947c1dba5c337d3a1 100644 (file)
@@ -126,11 +126,11 @@ class RefundForm(forms.Form):
                        raise ValidationError(errstr)
 
        def clean_vatamount(self):
-               errstr = "VAT Amount must be a decimal between 1 and {0}".format(self.invoice.total_vat)
+               errstr = "VAT Amount must be a decimal between 0 and {0}".format(self.invoice.total_vat)
 
                try:
                        amount = Decimal(self.cleaned_data['vatamount'])
-                       if amount < 1 or amount > self.invoice.total_vat:
+                       if amount < 0 or amount > self.invoice.total_vat:
                                raise ValidationError(errstr)
                        if amount.as_tuple().exponent > 0 or amount.as_tuple().exponent < -2:
                                raise ValidationError("Maximum two decimal digits supported")