1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-22 15:32:22 +00:00

clean specialTransaction

This commit is contained in:
Pierre-antoine Comby 2020-04-18 15:59:06 +02:00
parent 53748cd534
commit cc97948c24

View File

@ -252,6 +252,17 @@ class SpecialTransaction(Transaction):
def type(self):
return _('Credit') if isinstance(self.source, NoteSpecial) else _("Debit")
def is_credit(self):
return isinstance(self.source, NoteSpecial)
def is_debit(self):
return isinstance(self.destination, NoteSpecial)
def clean(self):
# SpecialTransaction are only possible with NoteSpecial object
if self.is_credit() == self.is_debit():
raise(ValidationError(_("A special transaction is only possible between a Note associated to a payment method and a User or a Club")))
class MembershipTransaction(Transaction):
"""