1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

Move transfer type selector in credit/debit mode

This commit is contained in:
Yohann D'ANELLO
2020-08-31 23:06:21 +02:00
parent e74f92cf8d
commit 5642c268e9
6 changed files with 166 additions and 114 deletions

View File

@ -173,14 +173,16 @@ class TransactionSerializer(serializers.ModelSerializer):
The djangorestframework plugin will analyse the model `Transaction` and parse all fields in the API.
"""
def validate_source(self, value):
if value.is_active:
if not value.is_active:
raise ValidationError(_("The transaction can't be saved since the source note "
"or the destination note is not active."))
return value
def validate_destination(self, value):
if value.is_active:
if not value.is_active:
raise ValidationError(_("The transaction can't be saved since the source note "
"or the destination note is not active."))
return value
class Meta:
model = Transaction