From 97597eb103e82c241153756622d8d1fd34fb86bd Mon Sep 17 00:00:00 2001 From: Ehouarn Date: Thu, 24 Jul 2025 12:26:44 +0200 Subject: [PATCH] Fixed 1A forms --- apps/wei/templates/wei/weimembership_form.html | 2 ++ apps/wei/views.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/wei/templates/wei/weimembership_form.html b/apps/wei/templates/wei/weimembership_form.html index 512f6f8d..a47ecf5c 100644 --- a/apps/wei/templates/wei/weimembership_form.html +++ b/apps/wei/templates/wei/weimembership_form.html @@ -149,6 +149,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
  • {% blocktrans trimmed with amount=fee|pretty_money %} Membership fees: {{ amount }} {% endblocktrans %}
  • + {% if not registration.first_year %} {% if registration.deposit_type == 'note' %}
  • {% blocktrans trimmed with amount=club.deposit_amount|pretty_money %} Deposit (by Note transaction): {{ amount }} @@ -158,6 +159,7 @@ SPDX-License-Identifier: GPL-3.0-or-later Deposit (by check): {{ amount }} {% endblocktrans %}
  • {% endif %} + {% endif %}
  • {% blocktrans trimmed with total=total_needed|pretty_money %} Total needed: {{ total }} {% endblocktrans %}
  • diff --git a/apps/wei/views.py b/apps/wei/views.py index 3bca3928..013f2b23 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -816,9 +816,12 @@ class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Update del form.fields["deposit_check"] # S'assurer que le champ deposit_type est obligatoire pour les 2A+ - if not self.object.first_year and "deposit_type" in form.fields: - form.fields["deposit_type"].required = True - form.fields["deposit_type"].help_text = _("Choose how you want to pay the deposit") + if "deposit_type" in form.fields: + if self.object.first_year: + del form.fields["deposit_type"] + else: + form.fields["deposit_type"].required = True + form.fields["deposit_type"].help_text = _("Choose how you want to pay the deposit") return form @@ -879,7 +882,6 @@ class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Update information["preferred_roles_name"] = [role.name for role in choose_bus_form.cleaned_data["roles"]] form.instance.information = information - # Sauvegarder le type de caution pour les 2A+ if "deposit_type" in form.cleaned_data: form.instance.deposit_type = form.cleaned_data["deposit_type"] form.instance.save()