Prevent superusers when they make a transaction with a non-member user

This commit is contained in:
Yohann D'ANELLO 2020-08-05 20:40:30 +02:00
parent 2851d7764c
commit 018ca84e2d
5 changed files with 45 additions and 9 deletions

View file

@ -202,7 +202,8 @@ class Transaction(PolymorphicModel):
When saving, also transfer money between two notes
"""
with transaction.atomic():
self.refresh_from_db()
if self.pk:
self.refresh_from_db()
self.source.refresh_from_db()
self.destination.refresh_from_db()
self.validate(False)