Browse Source

Fixed Transaction ,-usage and error for transactiontype

master
Sebastian Lohff 11 years ago
parent
commit
9bad46cf2d
  1. 2
      k4ever/main/fields.py
  2. 3
      k4ever/transaction/forms.py

2
k4ever/main/fields.py

@ -23,7 +23,7 @@ class CurrencyField (forms.RegexField): @@ -23,7 +23,7 @@ class CurrencyField (forms.RegexField):
self.currencyRe, None, None, *args, **kwargs)
def to_python(self, value):
try:
value = Decimal(value)
value = Decimal(value.replace(",", "."))
except (ValueError, TypeError, InvalidOperation):
raise ValidationError("Bitte gib eine Zahl ein")
return value

3
k4ever/transaction/forms.py

@ -18,7 +18,8 @@ class TransactionForm(forms.ModelForm): @@ -18,7 +18,8 @@ class TransactionForm(forms.ModelForm):
def clean(self):
# needed to enforce TransactionTypes needsCheck "default value"
cleaned_data = super(TransactionForm, self).clean()
self.instance.checked = not cleaned_data['transactionType'].needsCheck
if cleaned_data.has_key("transactionType"):
self.instance.checked = not cleaned_data['transactionType'].needsCheck
return cleaned_data
class VirtualTransactionForm(forms.ModelForm):

Loading…
Cancel
Save