mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-26 18:37:12 +00:00
Compare commits
49 Commits
da222c369a
...
e9506fe133
Author | SHA1 | Date | |
---|---|---|---|
|
e9506fe133 | ||
|
b8f81048a5 | ||
|
af819f45a1 | ||
|
076d065ffa | ||
|
2da77d9c17 | ||
|
01584d6330 | ||
|
4c0a5922c4 | ||
|
f90b28fc7c | ||
|
925e0f26f5 | ||
|
c912383f86 | ||
|
32830e43fd | ||
|
11c6a6fa7a | ||
|
201d6b114a | ||
|
19e77df299 | ||
|
5fd6ec5668 | ||
|
10a01c5bc2 | ||
|
989905ea64 | ||
|
0218d43a17 | ||
|
5d30b0e819 | ||
|
ec759dd3c0 | ||
|
2eb965291d | ||
|
7f182ee2ee | ||
|
3132aa4c38 | ||
|
c7eb774859 | ||
|
32f8d285b3 | ||
|
050256ea13 | ||
|
7afd15b1cc | ||
|
258361f116 | ||
|
a307530579 | ||
|
5de930bf40 | ||
|
f7ebe0e99b | ||
|
73de6e2176 | ||
|
201611b105 | ||
|
40c239e9da | ||
|
2aaab2b454 | ||
|
fc088dec86 | ||
|
2d60f1fd7b | ||
|
7b48b09329 | ||
|
ffac940511 | ||
|
50f98fd5ad | ||
|
402e19d1ce | ||
|
0b0394b61f | ||
|
98422d8259 | ||
|
29509b5b26 | ||
|
0d64ad31e0 | ||
|
5781cbd6a5 | ||
|
5295e61a00 | ||
|
e79ed6226a | ||
|
68152e6354 |
@ -8,19 +8,19 @@ variables:
|
|||||||
GIT_SUBMODULE_STRATEGY: recursive
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
|
|
||||||
# Debian Buster
|
# Debian Buster
|
||||||
py37-django22:
|
# py37-django22:
|
||||||
stage: test
|
# stage: test
|
||||||
image: debian:buster-backports
|
# image: debian:buster-backports
|
||||||
before_script:
|
# before_script:
|
||||||
- >
|
# - >
|
||||||
apt-get update &&
|
# apt-get update &&
|
||||||
apt-get install --no-install-recommends -t buster-backports -y
|
# apt-get install --no-install-recommends -t buster-backports -y
|
||||||
python3-django python3-django-crispy-forms
|
# python3-django python3-django-crispy-forms
|
||||||
python3-django-extensions python3-django-filters python3-django-polymorphic
|
# python3-django-extensions python3-django-filters python3-django-polymorphic
|
||||||
python3-djangorestframework python3-django-oauth-toolkit python3-psycopg2 python3-pil
|
# python3-djangorestframework python3-django-oauth-toolkit python3-psycopg2 python3-pil
|
||||||
python3-babel python3-lockfile python3-pip python3-phonenumbers python3-memcache
|
# python3-babel python3-lockfile python3-pip python3-phonenumbers python3-memcache
|
||||||
python3-bs4 python3-setuptools tox texlive-xetex
|
# python3-bs4 python3-setuptools tox texlive-xetex
|
||||||
script: tox -e py37-django22
|
# script: tox -e py37-django22
|
||||||
|
|
||||||
# Ubuntu 20.04
|
# Ubuntu 20.04
|
||||||
py38-django22:
|
py38-django22:
|
||||||
@ -56,7 +56,7 @@ py39-django22:
|
|||||||
|
|
||||||
linters:
|
linters:
|
||||||
stage: quality-assurance
|
stage: quality-assurance
|
||||||
image: debian:buster-backports
|
image: debian:bullseye
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update && apt-get install -y tox
|
- apt-get update && apt-get install -y tox
|
||||||
script: tox -e linters
|
script: tox -e linters
|
||||||
|
18
apps/activity/migrations/0003_auto_20240323_1422.py
Normal file
18
apps/activity/migrations/0003_auto_20240323_1422.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 2.2.28 on 2024-03-23 13:22
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('activity', '0002_auto_20200904_2341'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='activity',
|
||||||
|
name='description',
|
||||||
|
field=models.TextField(blank=True, default='', verbose_name='description'),
|
||||||
|
),
|
||||||
|
]
|
@ -66,6 +66,8 @@ class Activity(models.Model):
|
|||||||
|
|
||||||
description = models.TextField(
|
description = models.TextField(
|
||||||
verbose_name=_('description'),
|
verbose_name=_('description'),
|
||||||
|
blank=True,
|
||||||
|
default="",
|
||||||
)
|
)
|
||||||
|
|
||||||
location = models.CharField(
|
location = models.CharField(
|
||||||
|
@ -18,3 +18,26 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block extrajavascript %}
|
||||||
|
<script>
|
||||||
|
var date_end = document.getElementById("id_date_end");
|
||||||
|
var date_start = document.getElementById("id_date_start");
|
||||||
|
|
||||||
|
function update_date_end (){
|
||||||
|
if(date_end.value=="" || date_end.value<date_start.value){
|
||||||
|
date_end.value = date_start.value;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
function update_date_start (){
|
||||||
|
if(date_start.value=="" || date_end.value<date_start.value){
|
||||||
|
date_start.value = date_end.value;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
date_start.addEventListener('focusout', update_date_end);
|
||||||
|
date_end.addEventListener('focusout', update_date_start);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
@ -17,7 +17,8 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
from django.views import View
|
from django.views import View
|
||||||
from django.views.decorators.cache import cache_page
|
from django.views.decorators.cache import cache_page
|
||||||
from django.views.generic import DetailView, TemplateView, UpdateView
|
from django.views.generic import DetailView, TemplateView, UpdateView
|
||||||
from django_tables2.views import SingleTableView
|
from django.views.generic.list import ListView
|
||||||
|
from django_tables2.views import MultiTableMixin
|
||||||
from note.models import Alias, NoteSpecial, NoteUser
|
from note.models import Alias, NoteSpecial, NoteUser
|
||||||
from permission.backends import PermissionBackend
|
from permission.backends import PermissionBackend
|
||||||
from permission.views import ProtectQuerysetMixin, ProtectedCreateView
|
from permission.views import ProtectQuerysetMixin, ProtectedCreateView
|
||||||
@ -57,26 +58,40 @@ class ActivityCreateView(ProtectQuerysetMixin, ProtectedCreateView):
|
|||||||
return reverse_lazy('activity:activity_detail', kwargs={"pk": self.object.pk})
|
return reverse_lazy('activity:activity_detail', kwargs={"pk": self.object.pk})
|
||||||
|
|
||||||
|
|
||||||
class ActivityListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
|
class ActivityListView(ProtectQuerysetMixin, LoginRequiredMixin, MultiTableMixin, ListView):
|
||||||
"""
|
"""
|
||||||
Displays all Activities, and classify if they are on-going or upcoming ones.
|
Displays all Activities, and classify if they are on-going or upcoming ones.
|
||||||
"""
|
"""
|
||||||
model = Activity
|
model = Activity
|
||||||
table_class = ActivityTable
|
tables = [ActivityTable, ActivityTable]
|
||||||
ordering = ('-date_start',)
|
|
||||||
extra_context = {"title": _("Activities")}
|
extra_context = {"title": _("Activities")}
|
||||||
|
|
||||||
def get_queryset(self, **kwargs):
|
def get_queryset(self, **kwargs):
|
||||||
return super().get_queryset(**kwargs).distinct()
|
return super().get_queryset(**kwargs).distinct()
|
||||||
|
|
||||||
|
def get_tables(self):
|
||||||
|
tables = super().get_tables()
|
||||||
|
|
||||||
|
tables[0].prefix = "all-"
|
||||||
|
tables[1].prefix = "upcoming-"
|
||||||
|
return tables
|
||||||
|
|
||||||
|
def get_tables_data(self):
|
||||||
|
# first table = all activities, second table = upcoming
|
||||||
|
return [
|
||||||
|
self.get_queryset().order_by("-date_start"),
|
||||||
|
Activity.objects.filter(date_end__gt=timezone.now())
|
||||||
|
.filter(PermissionBackend.filter_queryset(self.request, Activity, "view"))
|
||||||
|
.distinct()
|
||||||
|
.order_by("date_start")
|
||||||
|
]
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
upcoming_activities = Activity.objects.filter(date_end__gt=timezone.now())
|
tables = context["tables"]
|
||||||
context['upcoming'] = ActivityTable(
|
for name, table in zip(["table", "upcoming"], tables):
|
||||||
data=upcoming_activities.filter(PermissionBackend.filter_queryset(self.request, Activity, "view")),
|
context[name] = table
|
||||||
prefix='upcoming-',
|
|
||||||
)
|
|
||||||
|
|
||||||
started_activities = self.get_queryset().filter(open=True, valid=True).distinct().all()
|
started_activities = self.get_queryset().filter(open=True, valid=True).distinct().all()
|
||||||
context["started_activities"] = started_activities
|
context["started_activities"] = started_activities
|
||||||
|
@ -121,7 +121,7 @@ class ImageForm(forms.Form):
|
|||||||
frame = frame.crop((x, y, x + w, y + h))
|
frame = frame.crop((x, y, x + w, y + h))
|
||||||
frame = frame.resize(
|
frame = frame.resize(
|
||||||
(settings.PIC_WIDTH, settings.PIC_RATIO * settings.PIC_WIDTH),
|
(settings.PIC_WIDTH, settings.PIC_RATIO * settings.PIC_WIDTH),
|
||||||
Image.ANTIALIAS,
|
Image.LANCZOS,
|
||||||
)
|
)
|
||||||
frames.append(frame)
|
frames.append(frame)
|
||||||
|
|
||||||
@ -138,6 +138,9 @@ class ImageForm(forms.Form):
|
|||||||
|
|
||||||
return cleaned_data
|
return cleaned_data
|
||||||
|
|
||||||
|
def is_valid(self):
|
||||||
|
return super().is_valid() or super().clean().get('image') is None
|
||||||
|
|
||||||
|
|
||||||
class ClubForm(forms.ModelForm):
|
class ClubForm(forms.ModelForm):
|
||||||
def clean(self):
|
def clean(self):
|
||||||
@ -151,7 +154,7 @@ class ClubForm(forms.ModelForm):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Club
|
model = Club
|
||||||
fields = '__all__'
|
exclude = ("add_registration_form",)
|
||||||
widgets = {
|
widgets = {
|
||||||
"membership_fee_paid": AmountInput(),
|
"membership_fee_paid": AmountInput(),
|
||||||
"membership_fee_unpaid": AmountInput(),
|
"membership_fee_unpaid": AmountInput(),
|
||||||
|
18
apps/member/migrations/0012_club_add_registration_form.py
Normal file
18
apps/member/migrations/0012_club_add_registration_form.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 2.2.28 on 2024-07-15 09:24
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('member', '0011_profile_vss_charter_read'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='club',
|
||||||
|
name='add_registration_form',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='add to registration form'),
|
||||||
|
),
|
||||||
|
]
|
@ -259,6 +259,11 @@ class Club(models.Model):
|
|||||||
help_text=_('Maximal date of a membership, after which members must renew it.'),
|
help_text=_('Maximal date of a membership, after which members must renew it.'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_registration_form = models.BooleanField(
|
||||||
|
verbose_name=_("add to registration form"),
|
||||||
|
default=False,
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("club")
|
verbose_name = _("club")
|
||||||
verbose_name_plural = _("clubs")
|
verbose_name_plural = _("clubs")
|
||||||
|
@ -14,6 +14,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
<form method="post" enctype="multipart/form-data" id="formUpload">
|
<form method="post" enctype="multipart/form-data" id="formUpload">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form |crispy }}
|
{{ form |crispy }}
|
||||||
|
{% if user.note.display_image != "pic/default.png" %}
|
||||||
|
<input type="submit" class="btn btn-primary" value="{% trans "Remove" %}">
|
||||||
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<!-- MODAL TO CROP THE IMAGE -->
|
<!-- MODAL TO CROP THE IMAGE -->
|
||||||
|
@ -26,7 +26,7 @@ from permission.backends import PermissionBackend
|
|||||||
from permission.models import Role
|
from permission.models import Role
|
||||||
from permission.views import ProtectQuerysetMixin, ProtectedCreateView
|
from permission.views import ProtectQuerysetMixin, ProtectedCreateView
|
||||||
|
|
||||||
from .forms import UserForm, ProfileForm, ImageForm, ClubForm, MembershipForm,\
|
from .forms import UserForm, ProfileForm, ImageForm, ClubForm, MembershipForm, \
|
||||||
CustomAuthenticationForm, MembershipRolesForm
|
CustomAuthenticationForm, MembershipRolesForm
|
||||||
from .models import Club, Membership
|
from .models import Club, Membership
|
||||||
from .tables import ClubTable, UserTable, MembershipTable, ClubManagerTable
|
from .tables import ClubTable, UserTable, MembershipTable, ClubManagerTable
|
||||||
@ -326,6 +326,9 @@ class PictureUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, Det
|
|||||||
"""Save image to note"""
|
"""Save image to note"""
|
||||||
image = form.cleaned_data['image']
|
image = form.cleaned_data['image']
|
||||||
|
|
||||||
|
if image is None:
|
||||||
|
image = "pic/default.png"
|
||||||
|
else:
|
||||||
# Rename as a PNG or GIF
|
# Rename as a PNG or GIF
|
||||||
extension = image.name.split(".")[-1]
|
extension = image.name.split(".")[-1]
|
||||||
if extension == "gif":
|
if extension == "gif":
|
||||||
|
@ -13,7 +13,7 @@ from rest_framework import status
|
|||||||
from api.viewsets import ReadProtectedModelViewSet, ReadOnlyProtectedModelViewSet
|
from api.viewsets import ReadProtectedModelViewSet, ReadOnlyProtectedModelViewSet
|
||||||
from permission.backends import PermissionBackend
|
from permission.backends import PermissionBackend
|
||||||
|
|
||||||
from .serializers import NotePolymorphicSerializer, AliasSerializer, ConsumerSerializer,\
|
from .serializers import NotePolymorphicSerializer, AliasSerializer, ConsumerSerializer, \
|
||||||
TemplateCategorySerializer, TransactionTemplateSerializer, TransactionPolymorphicSerializer, \
|
TemplateCategorySerializer, TransactionTemplateSerializer, TransactionPolymorphicSerializer, \
|
||||||
TrustSerializer
|
TrustSerializer
|
||||||
from ..models.notes import Note, Alias, NoteUser, NoteClub, NoteSpecial, Trust
|
from ..models.notes import Note, Alias, NoteUser, NoteClub, NoteSpecial, Trust
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Par ailleurs, le BDE ne sert pas d'alcool aux adhérents dont le solde
|
Par ailleurs, le BDE ne sert pas d'alcool aux adhérents dont le solde
|
||||||
est inférieur à 0 € depuis plus de 24h.
|
est inférieur à 0 €.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -10,7 +10,7 @@ from django.urls import reverse
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from permission.models import Role
|
from permission.models import Role
|
||||||
|
|
||||||
from ..api.views import AliasViewSet, ConsumerViewSet, NotePolymorphicViewSet, TemplateCategoryViewSet,\
|
from ..api.views import AliasViewSet, ConsumerViewSet, NotePolymorphicViewSet, TemplateCategoryViewSet, \
|
||||||
TransactionTemplateViewSet, TransactionViewSet
|
TransactionTemplateViewSet, TransactionViewSet
|
||||||
from ..models import NoteUser, Transaction, TemplateCategory, TransactionTemplate, RecurrentTransaction, \
|
from ..models import NoteUser, Transaction, TemplateCategory, TransactionTemplate, RecurrentTransaction, \
|
||||||
MembershipTransaction, SpecialTransaction, NoteSpecial, Alias, Note
|
MembershipTransaction, SpecialTransaction, NoteSpecial, Alias, Note
|
||||||
|
@ -2591,12 +2591,12 @@
|
|||||||
"note",
|
"note",
|
||||||
"transaction"
|
"transaction"
|
||||||
],
|
],
|
||||||
"query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}}, {\"valid\": false}]",
|
"query": "[\"OR\", {\"source__balance__gte\": 0}, [\"AND\", [\"NOT\", {\"recurrenttransaction__template__category__name\": \"Alcool\"}], {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}}], {\"valid\": false}]",
|
||||||
"type": "add",
|
"type": "add",
|
||||||
"mask": 2,
|
"mask": 2,
|
||||||
"field": "",
|
"field": "",
|
||||||
"permanent": false,
|
"permanent": false,
|
||||||
"description": "Créer une transaction quelconque tant que la source reste au-dessus de -20 €"
|
"description": "Créer une transaction quelconque tant que la source reste positive s'il s'agit d'alcool, sinon au-dessus de -20€"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -3228,7 +3228,8 @@
|
|||||||
"name": "Pr\u00e9sident\u00b7e de club",
|
"name": "Pr\u00e9sident\u00b7e de club",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
62,
|
62,
|
||||||
142
|
142,
|
||||||
|
135
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,6 @@ from django import forms
|
|||||||
from django.contrib.auth.forms import UserCreationForm
|
from django.contrib.auth.forms import UserCreationForm
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from member.models import Club
|
|
||||||
from note.models import NoteSpecial, Alias
|
from note.models import NoteSpecial, Alias
|
||||||
from note_kfet.inputs import AmountInput
|
from note_kfet.inputs import AmountInput
|
||||||
|
|
||||||
@ -115,12 +114,3 @@ class ValidationForm(forms.Form):
|
|||||||
required=False,
|
required=False,
|
||||||
initial=True,
|
initial=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# If the bda exists
|
|
||||||
if Club.objects.filter(name__iexact="bda").exists():
|
|
||||||
# The user can join the bda club at the inscription
|
|
||||||
join_bda = forms.BooleanField(
|
|
||||||
label=_("Join BDA Club"),
|
|
||||||
required=False,
|
|
||||||
initial=True,
|
|
||||||
)
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
|
# Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
@ -238,9 +239,8 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
|
|||||||
fee += bde.membership_fee_paid if user.profile.paid else bde.membership_fee_unpaid
|
fee += bde.membership_fee_paid if user.profile.paid else bde.membership_fee_unpaid
|
||||||
kfet = Club.objects.get(name="Kfet")
|
kfet = Club.objects.get(name="Kfet")
|
||||||
fee += kfet.membership_fee_paid if user.profile.paid else kfet.membership_fee_unpaid
|
fee += kfet.membership_fee_paid if user.profile.paid else kfet.membership_fee_unpaid
|
||||||
if Club.objects.filter(name__iexact="BDA").exists():
|
for club in Club.objects.filter(add_registration_form=True):
|
||||||
bda = Club.objects.get(name__iexact="BDA")
|
fee += club.membership_fee_paid if user.profile.paid else club.membership_fee_unpaid
|
||||||
fee += bda.membership_fee_paid if user.profile.paid else bda.membership_fee_unpaid
|
|
||||||
ctx["total_fee"] = "{:.02f}".format(fee / 100, )
|
ctx["total_fee"] = "{:.02f}".format(fee / 100, )
|
||||||
|
|
||||||
# ctx["declare_soge_account"] = SogeCredit.objects.filter(user=user).exists()
|
# ctx["declare_soge_account"] = SogeCredit.objects.filter(user=user).exists()
|
||||||
@ -249,6 +249,16 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
|
|||||||
|
|
||||||
def get_form(self, form_class=None):
|
def get_form(self, form_class=None):
|
||||||
form = super().get_form(form_class)
|
form = super().get_form(form_class)
|
||||||
|
|
||||||
|
# add clubs that are in registration form
|
||||||
|
for club in Club.objects.filter(add_registration_form=True).order_by("name"):
|
||||||
|
form_join_club = forms.BooleanField(
|
||||||
|
label=_("Join %(club)s Club") % {'club': club.name},
|
||||||
|
required=False,
|
||||||
|
initial=False,
|
||||||
|
)
|
||||||
|
form.fields.update({f"join_{club.id}": form_join_club})
|
||||||
|
|
||||||
user = self.get_object()
|
user = self.get_object()
|
||||||
form.fields["last_name"].initial = user.last_name
|
form.fields["last_name"].initial = user.last_name
|
||||||
form.fields["first_name"].initial = user.first_name
|
form.fields["first_name"].initial = user.first_name
|
||||||
@ -266,11 +276,6 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
|
|||||||
form.add_error(None, _("An alias with a similar name already exists."))
|
form.add_error(None, _("An alias with a similar name already exists."))
|
||||||
return self.form_invalid(form)
|
return self.form_invalid(form)
|
||||||
|
|
||||||
# Check if BDA exist to propose membership at regisration
|
|
||||||
bda_exists = False
|
|
||||||
if Club.objects.filter(name__iexact="BDA").exists():
|
|
||||||
bda_exists = True
|
|
||||||
|
|
||||||
# Get form data
|
# Get form data
|
||||||
# soge = form.cleaned_data["soge"]
|
# soge = form.cleaned_data["soge"]
|
||||||
credit_type = form.cleaned_data["credit_type"]
|
credit_type = form.cleaned_data["credit_type"]
|
||||||
@ -280,8 +285,9 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
|
|||||||
bank = form.cleaned_data["bank"]
|
bank = form.cleaned_data["bank"]
|
||||||
join_bde = form.cleaned_data["join_bde"]
|
join_bde = form.cleaned_data["join_bde"]
|
||||||
join_kfet = form.cleaned_data["join_kfet"]
|
join_kfet = form.cleaned_data["join_kfet"]
|
||||||
if bda_exists:
|
|
||||||
join_bda = form.cleaned_data["join_bda"]
|
clubs_registration = Club.objects.filter(add_registration_form=True).order_by("name")
|
||||||
|
join_clubs = [(club, form.cleaned_data[f"join_{club.id}"]) for club in clubs_registration]
|
||||||
|
|
||||||
# if soge:
|
# if soge:
|
||||||
# # If Société Générale pays the inscription, the user automatically joins the two clubs.
|
# # If Société Générale pays the inscription, the user automatically joins the two clubs.
|
||||||
@ -303,11 +309,12 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
|
|||||||
kfet_fee = kfet.membership_fee_paid if user.profile.paid else kfet.membership_fee_unpaid
|
kfet_fee = kfet.membership_fee_paid if user.profile.paid else kfet.membership_fee_unpaid
|
||||||
# Add extra fee for the full membership
|
# Add extra fee for the full membership
|
||||||
fee += kfet_fee if join_kfet else 0
|
fee += kfet_fee if join_kfet else 0
|
||||||
if bda_exists:
|
clubs_fee = dict()
|
||||||
bda = Club.objects.get(name__iexact="BDA")
|
for club, join_club in join_clubs:
|
||||||
bda_fee = bda.membership_fee_paid if user.profile.paid else bda.membership_fee_unpaid
|
club_fee = club.membership_fee_paid if user.profile.paid else club.membership_fee_unpaid
|
||||||
# Add extra fee for the bda membership
|
# Add extra fee for the club membership
|
||||||
fee += bda_fee if join_bda else 0
|
clubs_fee[club] = club_fee
|
||||||
|
fee += club_fee if join_club else 0
|
||||||
|
|
||||||
# # If the bank pays, then we don't credit now. Treasurers will validate the transaction
|
# # If the bank pays, then we don't credit now. Treasurers will validate the transaction
|
||||||
# # and credit the note later.
|
# # and credit the note later.
|
||||||
@ -387,12 +394,13 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
|
|||||||
membership.roles.add(Role.objects.get(name="Adhérent Kfet"))
|
membership.roles.add(Role.objects.get(name="Adhérent Kfet"))
|
||||||
membership.save()
|
membership.save()
|
||||||
|
|
||||||
if bda_exists and join_bda:
|
for club, join_club in join_clubs:
|
||||||
|
if join_club:
|
||||||
# Create membership for the user to the BDA starting today
|
# Create membership for the user to the BDA starting today
|
||||||
membership = Membership(
|
membership = Membership(
|
||||||
club=bda,
|
club=club,
|
||||||
user=user,
|
user=user,
|
||||||
fee=bda_fee,
|
fee=clubs_fee[club],
|
||||||
)
|
)
|
||||||
membership.save()
|
membership.save()
|
||||||
membership.refresh_from_db()
|
membership.refresh_from_db()
|
||||||
|
@ -5,7 +5,7 @@ from django_filters.rest_framework import DjangoFilterBackend
|
|||||||
from rest_framework.filters import SearchFilter
|
from rest_framework.filters import SearchFilter
|
||||||
from api.viewsets import ReadProtectedModelViewSet
|
from api.viewsets import ReadProtectedModelViewSet
|
||||||
|
|
||||||
from .serializers import InvoiceSerializer, ProductSerializer, RemittanceTypeSerializer, RemittanceSerializer,\
|
from .serializers import InvoiceSerializer, ProductSerializer, RemittanceTypeSerializer, RemittanceSerializer, \
|
||||||
SogeCreditSerializer
|
SogeCreditSerializer
|
||||||
from ..models import Invoice, Product, RemittanceType, Remittance, SogeCredit
|
from ..models import Invoice, Product, RemittanceType, Remittance, SogeCredit
|
||||||
|
|
||||||
|
18
apps/treasury/migrations/0007_auto_20240311_1549.py
Normal file
18
apps/treasury/migrations/0007_auto_20240311_1549.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 2.2.28 on 2024-03-11 14:49
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('treasury', '0006_auto_20230414_1651'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='invoice',
|
||||||
|
name='bde',
|
||||||
|
field=models.CharField(choices=[('RavePartlist', 'RavePart[list]'), ('SecretStorlist', 'SecretStor[list]'), ('TotalistSpies', 'Tota[list]Spies'), ('Saperlistpopette', 'Saper[list]popette'), ('Finalist', 'Fina[list]'), ('Listorique', '[List]orique'), ('Satellist', 'Satel[list]'), ('Monopolist', 'Monopo[list]'), ('Kataclist', 'Katac[list]')], default='RavePartlist', max_length=32, verbose_name='BDE'),
|
||||||
|
),
|
||||||
|
]
|
23
apps/treasury/migrations/0008_auto_20240322_0045.py
Normal file
23
apps/treasury/migrations/0008_auto_20240322_0045.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 2.2.28 on 2024-03-21 23:45
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('treasury', '0007_auto_20240311_1549'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='invoice',
|
||||||
|
name='payment_date',
|
||||||
|
field=models.CharField(default='', max_length=255, verbose_name='Payment date'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='invoice',
|
||||||
|
name='quotation',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='Quotation'),
|
||||||
|
),
|
||||||
|
]
|
@ -41,6 +41,10 @@ class Invoice(models.Model):
|
|||||||
),
|
),
|
||||||
verbose_name=_("BDE"),
|
verbose_name=_("BDE"),
|
||||||
)
|
)
|
||||||
|
quotation = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
verbose_name=_("Quotation"),
|
||||||
|
)
|
||||||
|
|
||||||
object = models.CharField(
|
object = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
@ -65,6 +69,12 @@ class Invoice(models.Model):
|
|||||||
verbose_name=_("Date"),
|
verbose_name=_("Date"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
payment_date = models.CharField(
|
||||||
|
default="",
|
||||||
|
max_length=255,
|
||||||
|
verbose_name=_("Payment date"),
|
||||||
|
)
|
||||||
|
|
||||||
acquitted = models.BooleanField(
|
acquitted = models.BooleanField(
|
||||||
verbose_name=_("Acquitted"),
|
verbose_name=_("Acquitted"),
|
||||||
default=False,
|
default=False,
|
||||||
|
@ -76,8 +76,11 @@
|
|||||||
|
|
||||||
\def\FactureNum {{"{"}}{{ obj.id }}} % Numéro de facture
|
\def\FactureNum {{"{"}}{{ obj.id }}} % Numéro de facture
|
||||||
\def\FactureAcquittee {% if obj.acquitted %} {oui} {% else %} {non} {% endif %} % Facture acquittée : oui/non
|
\def\FactureAcquittee {% if obj.acquitted %} {oui} {% else %} {non} {% endif %} % Facture acquittée : oui/non
|
||||||
|
\def\Devis {% if obj.quotation %} {oui} {% else %} {non} {% endif %}
|
||||||
|
% Devis : oui/non
|
||||||
\def\FactureLieu {{"{"}}{{ obj.place|escape_tex }}} % Lieu de l'édition de la facture
|
\def\FactureLieu {{"{"}}{{ obj.place|escape_tex }}} % Lieu de l'édition de la facture
|
||||||
\def\FactureDate {{"{"}}{{ obj.date }}} % Date de l'édition de la facture
|
\def\FactureDate {{"{"}}{{ obj.date }}} % Date de l'édition de la facture
|
||||||
|
\def\FacturePaymentDate {{"{"}}{{ obj.payment_date|escape_tex }}} % Date de paiement de la facture
|
||||||
\def\FactureObjet {{"{"}}{{ obj.object|escape_tex }} } % Objet du document
|
\def\FactureObjet {{"{"}}{{ obj.object|escape_tex }} } % Objet du document
|
||||||
% Description de la facture
|
% Description de la facture
|
||||||
\def\FactureDescr {{"{"}}{{ obj.description|escape_tex }}}
|
\def\FactureDescr {{"{"}}{{ obj.description|escape_tex }}}
|
||||||
@ -118,10 +121,12 @@
|
|||||||
% Nom et adresse de la société
|
% Nom et adresse de la société
|
||||||
\MonNom \\
|
\MonNom \\
|
||||||
\MonAdresseRue \\
|
\MonAdresseRue \\
|
||||||
\MonAdresseVille
|
\MonAdresseVille \\
|
||||||
|
\ifthenelse{\equal{\Devis}{oui}}{
|
||||||
|
Devis n°\FactureNum
|
||||||
|
}{
|
||||||
Facture n°\FactureNum
|
Facture n°\FactureNum
|
||||||
|
}
|
||||||
|
|
||||||
{\addtolength{\leftskip}{10.5cm} %in ERT
|
{\addtolength{\leftskip}{10.5cm} %in ERT
|
||||||
\ClientNom \\
|
\ClientNom \\
|
||||||
@ -139,6 +144,7 @@ Facture n°\FactureNum
|
|||||||
|
|
||||||
\textnormal{\FactureDescr}
|
\textnormal{\FactureDescr}
|
||||||
|
|
||||||
|
|
||||||
~\\
|
~\\
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
@ -154,6 +160,11 @@ Facture n°\FactureNum
|
|||||||
\ifthenelse{\equal{\FactureAcquittee}{oui}}{
|
\ifthenelse{\equal{\FactureAcquittee}{oui}}{
|
||||||
Facture acquittée.
|
Facture acquittée.
|
||||||
}{
|
}{
|
||||||
|
Echéance de paiement : \FacturePaymentDate
|
||||||
|
|
||||||
|
Conditions d'escompte : Aucune
|
||||||
|
|
||||||
|
Taux de pénalité en cas de non paiement ou retard de paiement : 0 \%
|
||||||
|
|
||||||
À régler par chèque ou par virement bancaire :
|
À régler par chèque ou par virement bancaire :
|
||||||
|
|
||||||
@ -176,5 +187,6 @@ Facture n°\FactureNum
|
|||||||
TVA non applicable, article 293 B du CGI.
|
TVA non applicable, article 293 B du CGI.
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
{% endlanguage %}
|
{% endlanguage %}
|
||||||
|
@ -69,9 +69,11 @@ class TestInvoices(TestCase):
|
|||||||
response = self.client.post(reverse("treasury:invoice_create"), data={
|
response = self.client.post(reverse("treasury:invoice_create"), data={
|
||||||
"id": 42,
|
"id": 42,
|
||||||
"object": "Same object",
|
"object": "Same object",
|
||||||
|
"quotation": True,
|
||||||
"description": "Longer description",
|
"description": "Longer description",
|
||||||
"name": "Me and others",
|
"name": "Me and others",
|
||||||
"address": "Alwways earth",
|
"address": "Alwways earth",
|
||||||
|
"payment_date": "Maybe someday...",
|
||||||
"acquitted": True,
|
"acquitted": True,
|
||||||
"products-0-designation": "Designation",
|
"products-0-designation": "Designation",
|
||||||
"products-0-quantity": 1,
|
"products-0-quantity": 1,
|
||||||
@ -97,8 +99,10 @@ class TestInvoices(TestCase):
|
|||||||
"object": "Same object",
|
"object": "Same object",
|
||||||
"description": "Longer description",
|
"description": "Longer description",
|
||||||
"name": "Me and others",
|
"name": "Me and others",
|
||||||
|
"quotation": False,
|
||||||
"address": "Always earth",
|
"address": "Always earth",
|
||||||
"acquitted": True,
|
"acquitted": True,
|
||||||
|
"payment_date": "Never",
|
||||||
"locked": True,
|
"locked": True,
|
||||||
"products-0-designation": "Designation",
|
"products-0-designation": "Designation",
|
||||||
"products-0-quantity": 1,
|
"products-0-quantity": 1,
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from .views import InvoiceCreateView, InvoiceListView, InvoiceUpdateView, InvoiceDeleteView, InvoiceRenderView,\
|
from .views import InvoiceCreateView, InvoiceListView, InvoiceUpdateView, InvoiceDeleteView, InvoiceRenderView, \
|
||||||
RemittanceListView, RemittanceCreateView, RemittanceUpdateView, LinkTransactionToRemittanceView,\
|
RemittanceListView, RemittanceCreateView, RemittanceUpdateView, LinkTransactionToRemittanceView, \
|
||||||
UnlinkTransactionToRemittanceView, SogeCreditListView, SogeCreditManageView
|
UnlinkTransactionToRemittanceView, SogeCreditListView, SogeCreditManageView
|
||||||
|
|
||||||
app_name = 'treasury'
|
app_name = 'treasury'
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
|||||||
"pk": 1,
|
"pk": 1,
|
||||||
"fields": {
|
"fields": {
|
||||||
"domain": "note.crans.org",
|
"domain": "note.crans.org",
|
||||||
"name": "La Note Kfet \ud83c\udf7b"
|
"name": "La Note Kfet 🍪"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -68,7 +68,7 @@ mark {
|
|||||||
/* background-color: rgb(18, 67, 4) !important; */
|
/* background-color: rgb(18, 67, 4) !important; */
|
||||||
/* MODE VIEUXCON=ON */
|
/* MODE VIEUXCON=ON */
|
||||||
/* background-color: rgb(166, 0, 2) !important; */
|
/* background-color: rgb(166, 0, 2) !important; */
|
||||||
background-color: rgb(0, 0, 0) !important;
|
background-color: rgb(100, 30, 100) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
@ -83,81 +83,81 @@ body {
|
|||||||
.btn-outline-primary:hover,
|
.btn-outline-primary:hover,
|
||||||
.btn-outline-primary:not(:disabled):not(.disabled).active,
|
.btn-outline-primary:not(:disabled):not(.disabled).active,
|
||||||
.btn-outline-primary:not(:disabled):not(.disabled):active {
|
.btn-outline-primary:not(:disabled):not(.disabled):active {
|
||||||
color: rgb(241, 229, 52);
|
color: rgb(240, 200, 240);
|
||||||
background-color: rgb(228, 35, 132);
|
background-color: rgb(30, 120, 150);
|
||||||
border-color: rgb(228, 35, 132);
|
border-color: rgb(190, 150, 190);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-outline-primary {
|
.btn-outline-primary {
|
||||||
color: #fff;
|
color: #a2a;
|
||||||
background-color: #000;
|
background-color: #6bc;
|
||||||
border-color: #464647;
|
border-color: #719;
|
||||||
}
|
}
|
||||||
|
|
||||||
.turbolinks-progress-bar {
|
.turbolinks-progress-bar {
|
||||||
background-color: #12432E;
|
background-color: #12342E;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary:hover,
|
.btn-primary:hover,
|
||||||
.btn-primary:not(:disabled):not(.disabled).active,
|
.btn-primary:not(:disabled):not(.disabled).active,
|
||||||
.btn-primary:not(:disabled):not(.disabled):active {
|
.btn-primary:not(:disabled):not(.disabled):active {
|
||||||
color: rgb(241, 229, 52);
|
color: rgb(150, 200, 240);
|
||||||
background-color: rgb(228, 35, 132);
|
background-color: rgb(50, 100, 140);
|
||||||
border-color: rgb(228, 35, 132);
|
border-color: rgb(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
color: #fff;
|
color: #eae;
|
||||||
background-color: #000;
|
background-color: #616;
|
||||||
border-color: #adb5bd;
|
border-color: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.border-primary {
|
.border-primary {
|
||||||
border-color: rgb(228, 35, 132) !important;
|
border-color: rgb(222, 180, 222) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-secondary {
|
.btn-secondary {
|
||||||
color: #fff;
|
color: #eae;
|
||||||
background-color: #000;
|
background-color: #616;
|
||||||
border-color: #adb5bd;
|
border-color: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-secondary:hover,
|
.btn-secondary:hover,
|
||||||
.btn-secondary:not(:disabled):not(.disabled).active,
|
.btn-secondary:not(:disabled):not(.disabled).active,
|
||||||
.btn-secondary:not(:disabled):not(.disabled):active {
|
.btn-secondary:not(:disabled):not(.disabled):active {
|
||||||
color: rgb(241, 229, 52);
|
color: rgb(150, 200, 240);
|
||||||
background-color: rgb(228, 35, 132);
|
background-color: rgb(50, 100, 140);
|
||||||
border-color: rgb(228, 35, 132);
|
border-color: rgb(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.btn-outline-dark {
|
.btn-outline-dark {
|
||||||
color: #343a40;
|
color: #000000;
|
||||||
border-color: #343a40;
|
border-color: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-outline-dark:hover,
|
.btn-outline-dark:hover,
|
||||||
.btn-outline-dark:not(:disabled):not(.disabled).active,
|
.btn-outline-dark:not(:disabled):not(.disabled).active,
|
||||||
.btn-outline-dark:not(:disabled):not(.disabled):active {
|
.btn-outline-dark:not(:disabled):not(.disabled):active {
|
||||||
color: rgb(241, 229, 52);
|
color: rgb(50, 100, 160);
|
||||||
background-color: rgb(228, 35, 132);
|
background-color: rgb(240, 150, 240);
|
||||||
border-color: rgb(228, 35, 132);
|
border-color: rgb(50, 100, 160);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: rgb(228, 35, 132);
|
color: rgb(0, 150, 150);
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
color: rgb(228, 35, 132);
|
color: rgb(200, 0, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control:focus {
|
.form-control:focus {
|
||||||
box-shadow: 0 0 0 0.25rem rgb(228 35 132 / 50%);
|
box-shadow: 0 0 0 0.25rem rgb(0 150 150 / 50%);
|
||||||
border-color: rgb(228, 35, 132);
|
border-color: rgb(0, 200, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-outline-primary.focus {
|
.btn-outline-primary.focus {
|
||||||
box-shadow: 0 0 0 0.25rem rgb(228 35 132 / 10%);
|
box-shadow: 0 0 0 0.25rem rgb(0 150 150 / 22%);
|
||||||
}
|
}
|
||||||
|
@ -194,6 +194,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
class="text-muted">{% trans "Contact us" %}</a> —
|
class="text-muted">{% trans "Contact us" %}</a> —
|
||||||
<a href="mailto:{{ "SUPPORT_EMAIL" | getenv }}"
|
<a href="mailto:{{ "SUPPORT_EMAIL" | getenv }}"
|
||||||
class="text-muted">{% trans "Technical Support" %}</a> —
|
class="text-muted">{% trans "Technical Support" %}</a> —
|
||||||
|
<a href="https://perso.crans.org/club-bde/charte_informatique.pdf"
|
||||||
|
class="text-muted">{% trans "Charte Info (FR)" %}</a> —
|
||||||
<a href="https://note.crans.org/doc/faq/"
|
<a href="https://note.crans.org/doc/faq/"
|
||||||
class="text-muted">{% trans "FAQ (FR)" %}</a> —
|
class="text-muted">{% trans "FAQ (FR)" %}</a> —
|
||||||
</span>
|
</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user