Skip to content

Commit

Permalink
FIX: Transaction comments breaks when Recalc user
Browse files Browse the repository at this point in the history
If user banktransfers are recalculated transaction comments
would multiply. So cleaning lines before recalcultaion keeps
comments tidy.
  • Loading branch information
sbeach92 committed Mar 8, 2024
1 parent 5388465 commit 00a98c8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions utils/businesslogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ def updateuser(user):
"""
Updates the user's status based on the data in database. Can be called from outside.
"""

# Remove old user transaction comments:
usertransactions = BankTransaction.objects.filter(
user=user, has_been_used=False
)
for usertransaction in usertransactions:
logger.debug(f"Deleting comment of {usertransaction}")
usertransaction.comment = usertransaction.comment.partition("\n")[0] + "\n"
usertransaction.save()

# Check for custom invoices..
logger.debug("Examining custom invoices")
invoices = CustomInvoice.objects.filter(
Expand Down

0 comments on commit 00a98c8

Please sign in to comment.