remittance need preciser check (bug during import)

This commit is contained in:
Pierre-antoine Comby 2020-04-18 15:59:59 +02:00
parent cc97948c24
commit 038ddc2ab8
1 changed files with 7 additions and 2 deletions

View File

@ -8,5 +8,10 @@ def save_special_transaction(instance, created, **kwargs):
"""
When a special transaction is created, we create its linked proxy
"""
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()