Automatically link SpecialTransactions and their proxies
This commit is contained in:
parent
884a7d0f08
commit
cf45b08c5b
3 changed files with 45 additions and 0 deletions
12
apps/treasury/signals.py
Normal file
12
apps/treasury/signals.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from treasury.models import SpecialTransactionProxy
|
||||
|
||||
|
||||
def save_special_transaction(instance, created, **kwargs):
|
||||
"""
|
||||
When a special transaction is created, we create its linked proxy
|
||||
"""
|
||||
if created:
|
||||
SpecialTransactionProxy.objects.create(transaction=instance, remittance=None).save()
|
||||
Loading…
Add table
Add a link
Reference in a new issue