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

Fix creation of cotisation

This commit is contained in:
grisel-davy 2020-10-12 11:59:37 +02:00
parent bb861eb089
commit 8c06bd4fca

View file

@ -505,13 +505,14 @@ class Vente(RevMixin, AclMixin, models.Model):
def create_cotis(self, date_start_con=False, date_start_memb=False): def create_cotis(self, date_start_con=False, date_start_memb=False):
""" """
Creates a cotisation without initializing the dates (start and end ar set to self.facture.facture.date) and without saving it. You should use Facture.reorder_purchases to set the right dates. Creates a cotisation without initializing the dates (start and end ar set to self.facture.facture.date)
and without saving it. You should use Facture.reorder_purchases to set the right dates.
""" """
try: try:
invoice = self.facture.facture invoice = self.facture.facture
except Facture.DoesNotExist: except Facture.DoesNotExist:
return return
if not hasattr(self, "cotisation") and (self.duration_membership or self.duration_days_membership): if not hasattr(self, "cotisation") and self.test_membership_or_connection():
cotisation = Cotisation(vente=self) cotisation = Cotisation(vente=self)
if date_start_con: if date_start_con:
cotisation.date_start_con = date_start_con cotisation.date_start_con = date_start_con