From 69286beabfe8bd6345e41ef07f782336dfbef4ac Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Sun, 19 Apr 2020 19:19:06 +0000 Subject: [PATCH] Fix calls to invoice.save --- cotisations/models.py | 11 ++++++----- cotisations/views.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) 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",