From 39b9c1b3a9fa7dd82e385bbe8bf41e36140d765e Mon Sep 17 00:00:00 2001 From: grisel-davy Date: Fri, 17 Aug 2018 11:05:40 +0200 Subject: [PATCH 1/4] Fix #155 confusion entre request.user et user --- cotisations/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cotisations/views.py b/cotisations/views.py index 82db074b..bc999c57 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -854,7 +854,7 @@ def credit_solde(request, user, **_kwargs): p = get_object_or_404(Paiement, is_balance=True) return form({ 'factureform': refill_form, - 'balance': request.user.solde, + 'balance': user.solde, 'title': _("Refill your balance"), 'action_name': _("Pay"), 'max_balance': p.payment_method.maximum_balance, From 25a710395f0401134a5e8150cdaa7cbfe75f8e84 Mon Sep 17 00:00:00 2001 From: grisel-davy Date: Mon, 20 Aug 2018 10:26:23 +0200 Subject: [PATCH 2/4] envoyer le bon user pour les verifications --- cotisations/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cotisations/views.py b/cotisations/views.py index bc999c57..365677a2 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -827,7 +827,7 @@ def credit_solde(request, user, **_kwargs): kwargs={'userid': user.id} )) - refill_form = RechargeForm(request.POST or None, user=request.user) + refill_form = RechargeForm(request.POST or None, user=user) if refill_form.is_valid(): price = refill_form.cleaned_data['value'] invoice = Facture(user=user) From db198c46ad90cef928fe3e828fdfe4f1097a9351 Mon Sep 17 00:00:00 2001 From: grisel-davy Date: Mon, 27 Aug 2018 18:57:23 +0200 Subject: [PATCH 3/4] =?UTF-8?q?D=C3=A9confusion=20entre=20la=20personne=20?= =?UTF-8?q?qui=20fait=20l'action=20et=20le=20compte=20concern=C3=A9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cotisations/forms.py | 4 ++-- cotisations/views.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cotisations/forms.py b/cotisations/forms.py index 4c79fe0e..5b463a99 100644 --- a/cotisations/forms.py +++ b/cotisations/forms.py @@ -243,12 +243,12 @@ class RechargeForm(FormRevMixin, Form): label=_("Payment method") ) - def __init__(self, *args, user=None, **kwargs): + def __init__(self, *args, user=None, user_source, **kwargs): self.user = user super(RechargeForm, self).__init__(*args, **kwargs) self.fields['payment'].empty_label = \ _("Select a payment method") - self.fields['payment'].queryset = Paiement.find_allowed_payments(user).exclude(is_balance=True) + self.fields['payment'].queryset = Paiement.find_allowed_payments(user_source).exclude(is_balance=True) def clean(self): """ diff --git a/cotisations/views.py b/cotisations/views.py index 365677a2..a4a35825 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -827,7 +827,7 @@ def credit_solde(request, user, **_kwargs): kwargs={'userid': user.id} )) - refill_form = RechargeForm(request.POST or None, user=user) + refill_form = RechargeForm(request.POST or None, user=user, user_source=request.user) if refill_form.is_valid(): price = refill_form.cleaned_data['value'] invoice = Facture(user=user) From 3331999434844822ff541ea92eba4e474964c0fb Mon Sep 17 00:00:00 2001 From: chirac Date: Mon, 27 Aug 2018 19:04:27 +0200 Subject: [PATCH 4/4] Update forms.py, user_source=None --- cotisations/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cotisations/forms.py b/cotisations/forms.py index 5b463a99..9194597a 100644 --- a/cotisations/forms.py +++ b/cotisations/forms.py @@ -243,7 +243,7 @@ class RechargeForm(FormRevMixin, Form): label=_("Payment method") ) - def __init__(self, *args, user=None, user_source, **kwargs): + def __init__(self, *args, user=None, user_source=None, **kwargs): self.user = user super(RechargeForm, self).__init__(*args, **kwargs) self.fields['payment'].empty_label = \