From 8adaf5007e95679410d6595e78d289d79d4f6869 Mon Sep 17 00:00:00 2001 From: quark Date: Wed, 7 May 2025 14:58:01 +0200 Subject: [PATCH] fix bug with merged transactions in merge_club command --- management/commands/merge_club.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/management/commands/merge_club.py b/management/commands/merge_club.py index 50f698b..49bce1a 100644 --- a/management/commands/merge_club.py +++ b/management/commands/merge_club.py @@ -3,6 +3,7 @@ import getpass from time import sleep +from copy import copy from django.conf import settings from django.core.mail import mail_admins @@ -134,7 +135,8 @@ class Command(BaseCommand): for tr in transactions: if kwargs['verbosity'] >= 1: self.stdout.write(f"Removing {tr}…") - tr_merge = tr + tr_merge = copy(tr) + tr_merge.pk = None tr_merge.source = true_club.note local_created.append(tr_merge) if kwargs['verbosity'] >= 1: @@ -155,7 +157,8 @@ class Command(BaseCommand): for tr in transactions: if kwargs['verbosity'] >= 1: self.stdout.write(f"Removing {tr}…") - tr_merge = tr + tr_merge = copy(tr) + tr_merge.pk = None tr_merge.destination = true_club.note local_created.append(tr_merge) if kwargs['verbosity'] >= 1: @@ -279,6 +282,7 @@ class Command(BaseCommand): for club in fake_clubs: self.stdout.write(self.style.SUCCESS(f"Club {club} deleted and merge in {true_club}.")) deleted_clubs.append(clubs) + self.stdout.write(self.style.WARNING("There are problems with balance of inactive note impact by the fusion, run './manage.py check_consistency -a -f' to fix")) deleted += local_deleted created += local_created edited += local_edited