8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 22:22:26 +00:00

Fix get_subscription of invoice.

This commit is contained in:
Hugo LEVY-FALK 2019-01-21 20:52:28 +01:00
parent bc758a6bcb
commit 31ba9a271f

View file

@ -242,14 +242,16 @@ class Facture(BaseInvoice):
self.__original_control = self.control
def get_subscription(self):
"""Returns every subscription associated with this invoice."""
return Cotisation.objects.filter(
vente__in=self.vente_set.filter(
Q(type_cotisation='All') |
Q(type_cotisation='Cotisation')
Q(type_cotisation='Adhesion')
)
)
def is_subscription(self):
"""Returns True if this invoice contains at least one subscribtion."""
return bool(self.get_subscription())
def save(self, *args, **kwargs):
@ -265,6 +267,7 @@ class Facture(BaseInvoice):
def __str__(self):
return str(self.user) + ' ' + str(self.date)
@receiver(post_save, sender=Facture)
def facture_post_save(**kwargs):
"""
@ -795,7 +798,7 @@ class Paiement(RevMixin, AclMixin, models.Model):
if payment_method is not None and use_payment_method:
return payment_method.end_payment(invoice, request)
## So make this invoice valid, trigger send mail
# So make this invoice valid, trigger send mail
invoice.valid = True
invoice.save()