mirror of https://gitlab.crans.org/bde/nk20
SpecialTransactionProxy are force-saved
This commit is contained in:
parent
6dc7604e90
commit
224a0fdd8c
|
@ -28,6 +28,8 @@ class TreasuryConfig(AppConfig):
|
||||||
source__in=NoteSpecial.objects.filter(~Q(remittancetype=None)),
|
source__in=NoteSpecial.objects.filter(~Q(remittancetype=None)),
|
||||||
specialtransactionproxy=None,
|
specialtransactionproxy=None,
|
||||||
):
|
):
|
||||||
SpecialTransactionProxy.objects.create(transaction=transaction, remittance=None)
|
proxy = SpecialTransactionProxy(transaction=transaction, remittance=None)
|
||||||
|
proxy._force_save = True
|
||||||
|
proxy.save()
|
||||||
|
|
||||||
post_migrate.connect(setup_specialtransactions_proxies, sender=SpecialTransactionProxy)
|
post_migrate.connect(setup_specialtransactions_proxies, sender=SpecialTransactionProxy)
|
||||||
|
|
|
@ -10,9 +10,8 @@ def save_special_transaction(instance, created, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not hasattr(instance, "_no_signal"):
|
if not hasattr(instance, "_no_signal"):
|
||||||
if instance.is_credit():
|
if created and RemittanceType.objects.filter(
|
||||||
if created and RemittanceType.objects.filter(note=instance.source).exists():
|
note=instance.source if instance.is_credit() else instance.destination).exists():
|
||||||
SpecialTransactionProxy.objects.create(transaction=instance, remittance=None).save()
|
proxy = SpecialTransactionProxy(transaction=instance, remittance=None)
|
||||||
else:
|
proxy._force_save = True
|
||||||
if created and RemittanceType.objects.filter(note=instance.destination).exists():
|
proxy.save()
|
||||||
SpecialTransactionProxy.objects.create(transaction=instance, remittance=None).save()
|
|
||||||
|
|
Loading…
Reference in New Issue