From eda84600147e2aa137f2dd0a43228d8bae744d3b Mon Sep 17 00:00:00 2001 From: korenstin Date: Wed, 7 Aug 2024 19:12:22 +0200 Subject: [PATCH] Inclusif, admin and migrations (treasury summary) --- .../migrations/0013_auto_20240807_1409.py | 18 +++++++ .../note/mails/summary_notes_report.html | 26 +++++----- .../note/mails/summary_notes_report.txt | 26 +++++----- apps/treasury/admin.py | 20 +++++++- apps/treasury/migrations/0009_notesummary.py | 49 +++++++++++++++++++ 5 files changed, 111 insertions(+), 28 deletions(-) create mode 100644 apps/member/migrations/0013_auto_20240807_1409.py create mode 100644 apps/treasury/migrations/0009_notesummary.py diff --git a/apps/member/migrations/0013_auto_20240807_1409.py b/apps/member/migrations/0013_auto_20240807_1409.py new file mode 100644 index 00000000..d86135c1 --- /dev/null +++ b/apps/member/migrations/0013_auto_20240807_1409.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.28 on 2024-08-07 12:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('member', '0012_club_add_registration_form'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='promotion', + field=models.PositiveSmallIntegerField(default=2024, help_text='Year of entry to the school (None if not ENS student)', null=True, verbose_name='promotion'), + ), + ] diff --git a/apps/note/templates/note/mails/summary_notes_report.html b/apps/note/templates/note/mails/summary_notes_report.html index be15f7d5..17ba2155 100644 --- a/apps/note/templates/note/mails/summary_notes_report.html +++ b/apps/note/templates/note/mails/summary_notes_report.html @@ -13,47 +13,47 @@

- Tous les utilisateurs : + Tous les utilisateur⋅rices :

- Les adhérents BDE : + Les {{ summary.total_positive_user_bde + summary.total_zero_user_bde + summary.total_negative_user_bde }} adhérent⋅es BDE :

Clubs :

Clubs hors BDE / Kfet et club dont le nom fini par "- BDE" :

- Progression: + Progression :

-- diff --git a/apps/note/templates/note/mails/summary_notes_report.txt b/apps/note/templates/note/mails/summary_notes_report.txt index 5196450d..be7a5992 100644 --- a/apps/note/templates/note/mails/summary_notes_report.txt +++ b/apps/note/templates/note/mails/summary_notes_report.txt @@ -3,29 +3,29 @@ Récapitulatif de trésorerie au {{ summary.date|date:"d/m/Y" }} à {{ summary.date|date:"H:i:s" }} : -Tous les utilisateurs : - - Positifs : {{ summary.total_positive_user }} soit {{ summary.balance_positive_user }} euros +Tous les utilisateur⋅rices : + - Positifs : {{ summary.total_positive_user }} soit {{ summary.balance_positive_user / 100 }} € - Neutres : {{ summary.total_zero_user }} - - Négatifs : {{ summary.total_negative_user }} soit {{ summary.balance_negative_user }} euros + - Négatifs : {{ summary.total_negative_user }} soit {{ summary.balance_negative_user / 100 }} € -Les adhérents BDE : - - Positifs : {{ summary.total_positive_user_bde }} soit {{ summary.balance_positive_user_bde }} euros +Les {{ summary.total_positive_user_bde + summary.total_zero_user_bde + summary.total_negative_user_bde }} adhérent⋅es BDE : + - Positifs : {{ summary.total_positive_user_bde }} soit {{ summary.balance_positive_user_bde / 100 }} € - Neutres : {{ summary.total_zero_user_bde }} - - Négatifs : {{ summary.total_negative_user_bde }} soit {{ summary.balance_negative_user_bde }} euros + - Négatifs : {{ summary.total_negative_user_bde }} soit {{ summary.balance_negative_user_bde /100 }} € Clubs : - - Positifs : {{ summary.total_positive_club }} soit {{ summary.balance_positive_club }} euros + - Positifs : {{ summary.total_positive_club }} soit {{ summary.balance_positive_club / 100 }} € - Neutres : {{ summary.total_zero_club }} - - Négatifs : {{ summary.total_negative_club }} soit {{ summary.balance_negative_club }} euros + - Négatifs : {{ summary.total_negative_club }} soit {{ summary.balance_negative_club / 100 }} € Clubs hors BDE / Kfet et club dont le nom fini par "- BDE" : - - Positifs : {{ summary.total_positive_club_nbde }} soit {{ summary.balance_positive_club_nbde }} euros + - Positifs : {{ summary.total_positive_club_nbde }} soit {{ summary.balance_positive_club_nbde / 100 }} € - Neutres : {{ summary.total_zero_club_nbde }} - - Négatifs : {{ summary.total_negative_club_nbde }} soit {{ summary.balance_negative_club_nbde }} euros + - Négatifs : {{ summary.total_negative_club_nbde }} soit {{ summary.balance_negative_club_nbde / 100 }} € -Progression: - - Ceci correspond à une différence de {{ balance_difference_user }} euros pour les utilisateurs - - Ceci correspond à une différence de {{ balance_difference_club }} euros pour les clubs +Progression : + - Ceci correspond à une différence de {{ balance_difference_user / 100 }} € pour les utilisateur⋅rices + - Ceci correspond à une différence de {{ balance_difference_club / 100 }} € pour les clubs -- Le BDE diff --git a/apps/treasury/admin.py b/apps/treasury/admin.py index c435a4ff..209a0fd6 100644 --- a/apps/treasury/admin.py +++ b/apps/treasury/admin.py @@ -5,13 +5,13 @@ from django.contrib import admin from note_kfet.admin import admin_site from .forms import ProductForm -from .models import RemittanceType, Remittance, SogeCredit, Invoice, Product +from .models import Invoice, NoteSummary, Product, RemittanceType, Remittance, SogeCredit @admin.register(RemittanceType, site=admin_site) class RemittanceTypeAdmin(admin.ModelAdmin): """ - Admin customisation for RemiitanceType + Admin customisation for RemittanceType """ list_display = ('note', ) @@ -55,3 +55,19 @@ class InvoiceAdmin(admin.ModelAdmin): """ list_display = ('object', 'id', 'bde', 'name', 'date', 'acquitted',) inlines = (ProductInline,) + + +@admin.register(NoteSummary, site=admin_site) +class NoteSummaryAdmin(admin.ModelAdmin): + """ + Admin customisation for NoteSummary + """ + list_display = ( + 'date', 'total_positive_user', 'balance_positive_user', 'total_positive_user_bde', + 'balance_positive_user_bde', 'total_zero_user', 'total_zero_user_bde', 'total_negative_user', + 'balance_negative_user', 'total_negative_user_bde', 'balance_negative_user_bde', + 'total_vnegative_user', 'balance_vnegative_user', 'total_vnegative_user_bde', + 'balance_vnegative_user_bde', 'total_positive_club', 'balance_positive_club', + 'total_positive_club_nbde', 'balance_positive_club_nbde', 'total_zero_club', 'total_zero_club_nbde', + 'total_negative_club', 'balance_negative_club', 'total_negative_club_nbde', 'balance_negative_club_nbde', + ) diff --git a/apps/treasury/migrations/0009_notesummary.py b/apps/treasury/migrations/0009_notesummary.py new file mode 100644 index 00000000..a5aecdd6 --- /dev/null +++ b/apps/treasury/migrations/0009_notesummary.py @@ -0,0 +1,49 @@ +# Generated by Django 2.2.28 on 2024-08-07 12:09 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('treasury', '0008_auto_20240322_0045'), + ] + + operations = [ + migrations.CreateModel( + name='NoteSummary', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateField(default=datetime.date.today, verbose_name='Date')), + ('total_positive_user', models.PositiveIntegerField(verbose_name='Total positive user')), + ('balance_positive_user', models.PositiveIntegerField(verbose_name='Balance positive user')), + ('total_positive_user_bde', models.PositiveIntegerField(verbose_name='Total positive user BDE')), + ('balance_positive_user_bde', models.PositiveIntegerField(verbose_name='Balance positive user BDE')), + ('total_zero_user', models.PositiveIntegerField(verbose_name='Total zero user')), + ('total_zero_user_bde', models.PositiveIntegerField(verbose_name='Total zero user BDE')), + ('total_negative_user', models.PositiveIntegerField(verbose_name='Total negative user')), + ('balance_negative_user', models.PositiveIntegerField(verbose_name='Balance negative user')), + ('total_negative_user_bde', models.PositiveIntegerField(verbose_name='Total negative user BDE')), + ('balance_negative_user_bde', models.PositiveIntegerField(verbose_name='Balance negative user BDE')), + ('total_vnegative_user', models.PositiveIntegerField(verbose_name='Total very negative user')), + ('balance_vnegative_user', models.PositiveIntegerField(verbose_name='Balance very negative user')), + ('total_vnegative_user_bde', models.PositiveIntegerField(verbose_name='Total very negative user BDE')), + ('balance_vnegative_user_bde', models.PositiveIntegerField(verbose_name='Balance very negative user BDE')), + ('total_positive_club', models.PositiveIntegerField(verbose_name='Total positive club')), + ('balance_positive_club', models.PositiveIntegerField(verbose_name='Balance positive club')), + ('total_positive_club_nbde', models.PositiveIntegerField(verbose_name='Total positive club nbde')), + ('balance_positive_club_nbde', models.PositiveIntegerField(verbose_name='Balance positive club nbde')), + ('total_zero_club', models.PositiveIntegerField(verbose_name='Total zero club')), + ('total_zero_club_nbde', models.PositiveIntegerField(verbose_name='Total zero club nbde')), + ('total_negative_club', models.PositiveIntegerField(verbose_name='Total negative club')), + ('balance_negative_club', models.PositiveIntegerField(verbose_name='Balance negative club')), + ('total_negative_club_nbde', models.PositiveIntegerField(verbose_name='Total negative club nbde')), + ('balance_negative_club_nbde', models.PositiveIntegerField(verbose_name='Balance negative club nbde')), + ], + options={ + 'verbose_name': 'Summary', + 'verbose_name_plural': 'Summaries', + }, + ), + ]