1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-07-18 23:30:20 +02:00

Soge Credit changed

This commit is contained in:
Ehouarn
2025-07-15 17:43:21 +02:00
parent 4380414c6b
commit 3af35dc0fc
7 changed files with 59 additions and 54 deletions

View File

@ -353,7 +353,7 @@ class SogeCredit(models.Model):
def amount(self):
if self.valid:
return self.credit_transaction.total
amount = sum(transaction.total for transaction in self.transactions.all())
amount = sum(max(transaction.total - 2000, 0) for transaction in self.transactions.all())
if 'wei' in settings.INSTALLED_APPS:
from wei.models import WEIMembership
if not WEIMembership.objects\
@ -441,7 +441,7 @@ class SogeCredit(models.Model):
With Great Power Comes Great Responsibility...
"""
total_fee = sum(transaction.total for transaction in self.transactions.all() if not transaction.valid)
total_fee = sum(max(transaction.total - 2000, 0) for transaction in self.transactions.all() if not transaction.valid)
if self.user.note.balance < total_fee:
raise ValidationError(_("This user doesn't have enough money to pay the memberships with its note. "
"Please ask her/him to credit the note before invalidating this credit."))