From 038ddc2ab87ab384d85948a7fafa1b403bafab47 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Sat, 18 Apr 2020 15:59:59 +0200 Subject: [PATCH] remittance need preciser check (bug during import) --- apps/treasury/signals.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/treasury/signals.py b/apps/treasury/signals.py index 54c19c09..b7038ab6 100644 --- a/apps/treasury/signals.py +++ b/apps/treasury/signals.py @@ -8,5 +8,10 @@ def save_special_transaction(instance, created, **kwargs): """ When a special transaction is created, we create its linked proxy """ - if created and RemittanceType.objects.filter(note=instance.source).exists(): - SpecialTransactionProxy.objects.create(transaction=instance, remittance=None).save() + + if instance.is_credit(): + if created and RemittanceType.objects.filter(note=instance.source).exists(): + SpecialTransactionProxy.objects.create(transaction=instance, remittance=None).save() + else: + if created and RemittanceType.objects.filter(note=instance.destination).exists(): + SpecialTransactionProxy.objects.create(transaction=instance, remittance=None).save()