1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-20 17:41:55 +02:00

🐛 Prevent transactions to have the same source and destination

This commit is contained in:
Yohann D'ANELLO
2020-08-06 12:46:44 +02:00
parent 252ddb832d
commit d9cf812074
2 changed files with 8 additions and 2 deletions

View File

@ -222,8 +222,7 @@ class Transaction(PolymorphicModel):
self.destination_alias = str(self.destination)
if self.source.pk == self.destination.pk:
# When source == destination, no money is transferred
super().save(*args, **kwargs)
# When source == destination, no money is transferred and no transaction is created
return
self.log("Saving")