mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-11-04 01:12:08 +01:00 
			
		
		
		
	Merge branch 'import_nk15' of gitlab.crans.org:bde/nk20 into import_nk15
This commit is contained in:
		@@ -3,11 +3,11 @@
 | 
			
		||||
 | 
			
		||||
from .notes import Alias, Note, NoteClub, NoteSpecial, NoteUser
 | 
			
		||||
from .transactions import MembershipTransaction, Transaction, \
 | 
			
		||||
    TransactionCategory, TransactionTemplate, TransactionType
 | 
			
		||||
    TemplateCategory, TransactionTemplate, TransactionType
 | 
			
		||||
 | 
			
		||||
__all__ = [
 | 
			
		||||
    # Notes
 | 
			
		||||
    'Alias', 'Note', 'NoteClub', 'NoteSpecial', 'NoteUser',
 | 
			
		||||
    # Transactions
 | 
			
		||||
    'MembershipTransaction', 'Transaction', 'TransactionCategory', 'TransactionTemplate','TransactionType',
 | 
			
		||||
    'MembershipTransaction', 'Transaction', 'TemplateCategory', 'TransactionTemplate','TransactionType',
 | 
			
		||||
]
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ Defines transactions
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TransactionCategory(models.Model):
 | 
			
		||||
class TemplateCategory(models.Model):
 | 
			
		||||
    """
 | 
			
		||||
    Defined a recurrent transaction category
 | 
			
		||||
 | 
			
		||||
@@ -56,7 +56,7 @@ class TransactionTemplate(models.Model):
 | 
			
		||||
        help_text=_('in centimes'),
 | 
			
		||||
    )
 | 
			
		||||
    category = models.ForeignKey(
 | 
			
		||||
        TransactionCategory,
 | 
			
		||||
        TemplateCategory,
 | 
			
		||||
        on_delete=models.PROTECT,
 | 
			
		||||
        verbose_name=_('type'),
 | 
			
		||||
        max_length=31,
 | 
			
		||||
@@ -174,6 +174,26 @@ class Transaction(models.Model):
 | 
			
		||||
        return self.amount * self.quantity
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TemplateTransaction(Transaction):
 | 
			
		||||
    """
 | 
			
		||||
    Special type of :model:`note.Transaction` associated to a :model:`note.TransactionTemplate`.
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    template = models.ForeignKey(
 | 
			
		||||
        TransactionTemplate,
 | 
			
		||||
        null=True
 | 
			
		||||
        on_delete=models.SET_NULL
 | 
			
		||||
    )
 | 
			
		||||
    category = models.ForeignKey(
 | 
			
		||||
        TemplateCategory,
 | 
			
		||||
        on_delete=models.PROTECT
 | 
			
		||||
    )
 | 
			
		||||
    name = models.CharField(
 | 
			
		||||
        max_length=255
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class MembershipTransaction(Transaction):
 | 
			
		||||
    """
 | 
			
		||||
    Special type of :model:`note.Transaction` associated to a :model:`member.Membership`.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user