1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

Automatically link SpecialTransactions and their proxies

This commit is contained in:
Yohann D'ANELLO
2020-03-23 21:30:57 +01:00
parent 884a7d0f08
commit cf45b08c5b
3 changed files with 45 additions and 0 deletions

View File

@ -9,6 +9,10 @@ from note.models import NoteSpecial, SpecialTransaction
class Invoice(models.Model):
"""
An invoice model that can generate a true invoice
"""
id = models.PositiveIntegerField(
primary_key=True,
verbose_name=_("Invoice identifier"),
@ -57,6 +61,10 @@ class Invoice(models.Model):
class Product(models.Model):
"""
Product that appear on an invoice.
"""
invoice = models.ForeignKey(
Invoice,
on_delete=models.PROTECT,
@ -89,6 +97,10 @@ class Product(models.Model):
class Remittance(models.Model):
"""
Treasurers want to regroup checks or bank transfers in bank remittances.
"""
date = models.DateTimeField(
auto_now_add=True,
verbose_name=_("Date"),
@ -132,6 +144,12 @@ class Remittance(models.Model):
class SpecialTransactionProxy(models.Model):
"""
In order to keep modularity, we don't that the Note app depends on the treasury app.
That's why we create a proxy in this app, to link special transactions and remittances.
If it isn't very clean, that makes what we want.
"""
transaction = models.OneToOneField(
SpecialTransaction,
on_delete=models.CASCADE,