mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-12-23 07:52:23 +00:00
Fix SpecialTransaction proxies
This commit is contained in:
parent
cf45b08c5b
commit
d6e00f7bba
@ -2,7 +2,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
from django.db.models.signals import post_save
|
from django.db.models.signals import post_save, post_migrate
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
@ -20,6 +20,9 @@ class TreasuryConfig(AppConfig):
|
|||||||
from treasury.models import SpecialTransactionProxy
|
from treasury.models import SpecialTransactionProxy
|
||||||
post_save.connect(signals.save_special_transaction, sender=SpecialTransaction)
|
post_save.connect(signals.save_special_transaction, sender=SpecialTransaction)
|
||||||
|
|
||||||
# If the treasury app was disabled, we ensure that each special transaction is linked to a proxy
|
def setup_specialtransactions_proxies(**kwargs):
|
||||||
for transaction in SpecialTransaction.objects.filter(specialtransactionproxy=None):
|
# If the treasury app was disabled, we ensure that each special transaction is linked to a proxy
|
||||||
SpecialTransactionProxy.objects.create(transaction=transaction, remittance=None)
|
for transaction in SpecialTransaction.objects.filter(specialtransactionproxy=None):
|
||||||
|
SpecialTransactionProxy.objects.create(transaction=transaction, remittance=None)
|
||||||
|
|
||||||
|
post_migrate.connect(setup_specialtransactions_proxies, sender=SpecialTransactionProxy)
|
||||||
|
Loading…
Reference in New Issue
Block a user