diff --git a/cotisations/models.py b/cotisations/models.py index 503ad244..dcb62408 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -329,11 +329,12 @@ class Facture(BaseInvoice): purchase.save() def save(self, *args, **kwargs): - super(Facture, self).save(*args, **kwargs) + try: + request = kwargs.pop("request") + except: + request = None - request = None - if "request" in kwargs: - request = kwargs["request"] + super(Facture, self).save(*args, **kwargs) if not self.__original_valid and self.valid: self.reorder_purchases() @@ -875,7 +876,7 @@ class Paiement(RevMixin, AclMixin, models.Model): # So make this invoice valid, trigger send mail invoice.valid = True - invoice.save(request) + invoice.save(request=request) # In case a cotisation was bought, inform the user, the # cotisation time has been extended too diff --git a/cotisations/views.py b/cotisations/views.py index def26cda..62eabef6 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -1008,7 +1008,7 @@ def credit_solde(request, user, **_kwargs): else: price_ok = True if price_ok: - invoice.save(request) + invoice.save(request=request) Vente.objects.create( facture=invoice, name="solde",