update to Django 4

This commit is contained in:
Gregory Trullemans 2022-01-07 12:29:22 +01:00
parent 0b56c3b527
commit 3fd1ec035f
25 changed files with 115 additions and 103 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
# OS X
.DS_Store
# IDE
.vscode/

View File

@ -1,8 +1,9 @@
asgiref==3.2.3
Django==3.0.3
Markdown==2.6.11
Pillow==7.0.0
pytz==2019.3
PyYAML==3.12
reportlab==3.4.0
sqlparse==0.3.0
asgiref==3.4.1
Django==4.0.1
django-select2
Markdown==3.3.6
sqlparse==0.4.2
Pillow==9.0.0
pytz==2021.3
PyYAML==6.0
reportlab==3.6.5

View File

@ -9,7 +9,7 @@ coverage==4.4.2
django-debug-toolbar==1.9.1
flake8==3.5.0
isort==4.2.15
lazy-object-proxy==1.3.1
lazy-object-proxy==1.7.1
mccabe==0.6.1
pathspec==0.7.0
pyaml==17.12.1
@ -17,7 +17,6 @@ pycodestyle==2.3.1
pyflakes==1.6.0
pylint==1.8.1
regex==2020.1.8
six==1.11.0
six==1.16.0
toml==0.10.0
typed-ast==1.4.1
wrapt==1.10.11
wrapt==1.13.3

View File

@ -2,5 +2,6 @@ from django.apps import AppConfig
class BillingConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = "billing"
verbose_name = "Facturation"

View File

@ -1,4 +1,4 @@
from django.conf.urls import url
from django.urls import path
from .views import (
client_lookup,
@ -16,27 +16,25 @@ from .views import (
app_name = "billing"
urlpatterns = [
url(r"^client/lookup/$", client_lookup, name="client_lookup"),
url(r"^client/$", client_listing, name="client_listing"),
url(r"^client/(?P<client_id>[0-9]+)/$", client_details, name="client_details"),
url(r"^client/create/$", client_create_or_update, name="client_create"),
url(r"^client/update/(?P<client_id>[0-9]+)/$", client_create_or_update, name="client_update"),
url(r"^contract/lookup/$", contract_lookup, name="contract_lookup"),
url(r"^contract/$", contract_listing, name="contract_listing"),
url(
r"^contract/(?P<contract_id>[0-9]+)/$", contract_detail, name="contract_detail"
),
url(r"^contract/create/$", contract_create_or_update, name="contract_create"),
url(r"^contract/update/(?P<contract_id>[0-9]+)/$", contract_create_or_update, name="contract_update"),
url(
r"^contract/pdf/(?P<contract_id>[0-9]+)$",
contract_export,
name="contract_export",
),
url(r"^prestation/$", prestation_listing, name="prestation_listing"),
url(r"^prestation/create/$", prestation_create_or_update, name="prestation_create"),
url(r"^prestation/update/(?P<prestation_id>[0-9]+)/$", prestation_create_or_update, name="prestation_update"),
client_urlpatterns = [
path(r"lookup/", client_lookup, name="client_lookup"),
path(r"", client_listing, name="client_listing"),
path(r"<int:client_id>/", client_details, name="client_details"),
path(r"create/", client_create_or_update, name="client_create"),
path(r"update/<int:client_id>/", client_create_or_update, name="client_update"),
]
contract_urlpatterns = [
path(r"lookup/", contract_lookup, name="contract_lookup"),
path(r"", contract_listing, name="contract_listing"),
path(r"<int:contract_id>/", contract_detail, name="contract_detail"),
path(r"create/", contract_create_or_update, name="contract_create"),
path(r"update/<int:contract_id>/", contract_create_or_update, name="contract_update"),
path(r"pdf/<int:contract_id>/", contract_export, name="contract_export",),
]
prestation_urlpatterns = [
path(r"", prestation_listing, name="prestation_listing"),
path(r"create/", prestation_create_or_update, name="prestation_create"),
path(r"update/<int:prestation_id>/", prestation_create_or_update, name="prestation_update"),
]

View File

@ -74,12 +74,12 @@ DATABASES = {
}
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': 'cache.db',
}
}
# CACHES = {
# 'default': {
# 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
# 'LOCATION': 'cache.db',
# }
# }
# Password validation

View File

@ -13,22 +13,37 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import include, url
from django.contrib import admin
from django.urls import include, path
from comptabilite.views import year_listing
import billing.urls
import eventCompta.urls
import comptabilite.urls
urlpatterns = [
url(r'^select2/', include('django_select2.urls')),
url(r"^$", year_listing),
url(r"^admin/", admin.site.urls),
url(
r"^comptability/annual/",
include("comptabilite.urls", namespace="annualcomptability"),
path(r"select2/", include('django_select2.urls')),
# Comptabilité
path(
r"comptability/annual/",
include(comptabilite.urls.urlpatterns),
),
url(
r"^comptability/event/",
include("eventCompta.urls", namespace="eventcomptability"),
# Event comptabilité
path(
r"comptability/event/",
include(eventCompta.urls.urlpatterns),
),
url(r"^billing/", include("billing.urls", namespace="billing")),
# Billing
path(r"billing/client/", include(billing.urls.client_urlpatterns)),
path(r"billing/contract/", include(billing.urls.contract_urlpatterns)),
path(r"billing/prestation/", include(billing.urls.prestation_urlpatterns)),
# Home
path(r"", year_listing),
path(r"admin/", admin.site.urls),
]

View File

@ -2,5 +2,6 @@ from django.apps import AppConfig
class ComptabiliteConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = "comptabilite"
verbose_name = "Comptabilité annuelle"

View File

@ -1,14 +1,6 @@
import re
# from decimal import Decimal
from django import template
# from django.conf import settings
from django.utils.encoding import force_text
# from django.utils.formats import number_format
from django.utils.encoding import force_str
register = template.Library()
@ -29,7 +21,7 @@ def intdot(value, use_l10n=True):
# else:
# return number_format(value, force_grouping=True)
orig = force_text(value)
orig = force_str(value)
new = re.sub(r"^(-?\d+)(\d{3})", r"\g<1>.\g<2>", orig)
if orig == new:
return new

View File

@ -1,4 +1,5 @@
from django.conf.urls import url
# from django.conf.urls import path
from django.urls import path, re_path
from .views import (
year_listing,
@ -13,45 +14,45 @@ from .views import (
app_name = "annualcomptability"
urlpatterns = [
url(r"^$", year_listing, name="year_listing"),
url(
r"^listing/(?P<accounting_year>[0-9]{4})/(?P<transaction_kind>[A-Za-z]+)$",
path(r"", year_listing, name="year_listing"),
re_path(
r"^listing/(?P<accounting_year>[0-9]{4})/(?P<transaction_kind>[A-Za-z]+)/$",
transaction_by_year_listing,
name="by_year_bank",
),
url(
r"^listing/(?P<accounting_year>[0-9]{4})/(?P<transaction_kind>[A-Za-z]+)$",
re_path(
r"^listing/(?P<accounting_year>[0-9]{4})/(?P<transaction_kind>[A-Za-z]+)/$",
transaction_by_year_listing,
name="by_year_box",
),
url(
r"^listing/(?P<accounting_year>[0-9]{4})/(?P<transaction_type_id>[0-9]+)$",
re_path(
r"^listing/(?P<accounting_year>[0-9]{4})/<int:transaction_type_id>/$",
transaction_listing_for_year_and_type,
name="transaction_listing_for_year_and_type",
),
# http://127.0.0.1:8000/comptability/annual/listing/2017/3
url(
r"^listing/(?P<accounting_year>[0-9]{4})$",
re_path(
r"^listing/(?P<accounting_year>[0-9]{4})/$",
transaction_by_year_listing,
name="by_year",
),
url(
r"^details/(?P<transactionid>[0-9]+)",
path(
r"details/<int:transaction_id>/",
transaction_details,
name="compta_details",
),
url(
r"^export/simple/(?P<accounting_year>[0-9]{4})$",
re_path(
r"^export/simple/(?P<accounting_year>[0-9]{4})/$",
export_year_spf_finance,
name="export_simple",
),
url(
r"^export/(?P<accounting_year>[0-9]{4})/(?P<export_type>\w+)$",
re_path(
r"^export/(?P<accounting_year>[0-9]{4})/(?P<export_type>\w+)/$",
comptability_export,
name="export",
),
url(
r"^export/pdf/(?P<accounting_year>[0-9]{4})/",
re_path(
r"^export/pdf/(?P<accounting_year>[0-9]{4})/$",
generate_pdf_for_spf,
name="pdf_export",
),

View File

@ -372,13 +372,13 @@ def transaction_listing_for_year_and_type(
return render(request, "transaction_listing.html", context)
def transaction_details(request, transactionid):
def transaction_details(request, transaction_id):
"""
Récupère les détails d'une transaction.
Args:
transactionid (int): identifiant d'une transaction.
"""
transaction = Transaction.objects.get(pk=transactionid)
transaction = Transaction.objects.get(pk=transaction_id)
context = {"transaction": transaction}
return render(request, "year_transaction_details.html", context)

Binary file not shown.

View File

@ -4,5 +4,6 @@ from django.apps import AppConfig
class ManagementConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = "eventCompta"
verbose_name = "Comptabilité Evènementielle"

View File

@ -1,19 +1,19 @@
# coding=utf-8
from django.conf.urls import url
from django.urls import path
from .views import event_transaction_details, event_listing, event_transaction_listing
app_name = "eventcomptability"
urlpatterns = [
url(r"^$", event_listing, name="event_listing"),
url(
r"^details/(?P<transaction_id>[0-9]+)",
path(r"", event_listing, name="event_listing"),
path(
r"details/<int:transaction_id>/",
event_transaction_details,
name="event_compta_details",
),
url(
r"^(?P<event_id>[0-9]+)", event_transaction_listing, name="event_compta_listing"
path(
r"<int:event_id>/", event_transaction_listing, name="event_compta_listing"
),
]

View File

@ -25,7 +25,7 @@
{% for transaction in transaction_list %}
<tr {% if transaction.is_done == False or transaction.is_simulated == True %}class="alert alert-warning simulated"{% endif %}>
<td class="push-right">{{ transaction.registrationDate | date:"d-m-Y" }}</td>
<td><a href="{% url 'eventcomptability:event_compta_details' transaction.id %}">{{ transaction }}</a></td>
<td><a href="{% url 'event_compta_details' transaction.id %}">{{ transaction }}</a></td>
<td>{{ transaction.counterpart }}</td>
<td>{{ transaction.account_number }}</td>
{% if transaction.transaction_type.transaction_type == 0 %}

View File

@ -19,7 +19,7 @@
<tr>
<td>{{ transaction.id }}</td>
<td class="push-right">{{ transaction.registrationDate | date:"d-m-Y" }}</td>
<td><a href="{% url 'annualcomptability:compta_details' transaction.id %}">{{ transaction.description }}</a></td>
<td><a href="{% url 'compta_details' transaction.id %}">{{ transaction.description }}</a></td>
<td>{% if transaction.bkExtractNumber %}{{ transaction.bkExtractNumber }}{% endif %}</td>
<td class="push-right">{{ transaction.bkAmount }}</td>
<td>{% if transaction.bxExtractNumber %}{{ transaction.bxExtractNumber }}{% endif %}</td>

View File

@ -14,7 +14,7 @@
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<p align="right" class="noprint">
<a href="{% url 'annualcomptability:export' accounting_year 'sxs' %}">1 tableau</a> | <a href="{% url 'annualcomptability:export' accounting_year 'ooo' %}">2 tableaux</a> | <a href="{% url 'annualcomptability:export_simple' accounting_year %}">Export SPF</a>
<a href="{% url 'export' accounting_year 'sxs' %}">1 tableau</a> | <a href="{% url 'export' accounting_year 'ooo' %}">2 tableaux</a> | <a href="{% url 'export_simple' accounting_year %}">Export SPF</a>
</p>
</div>
</div>

View File

@ -22,11 +22,11 @@
</thead>
{% for accounting_year in year_list %}
<tr>
<td class="centered"><a href="{% url 'annualcomptability:by_year' accounting_year.0 %}">{{ accounting_year.0 }}</a></td>
<td class="centered"><a href="{% url 'by_year' accounting_year.0 %}">{{ accounting_year.0 }}</a></td>
<td class="push-right">{{ accounting_year.1 }}</td>
<td class="centered"><a href="{% url 'annualcomptability:by_year_bank' accounting_year.0 'bank' %}">Bancaire</a></td>
<td class="centered"><a href="{% url 'annualcomptability:by_year_box' accounting_year.0 'box' %}">Caisse</a></td>
<td class="centered"><a href="{% url 'annualcomptability:export_simple' accounting_year.0 %}">export</a></td>
<td class="centered"><a href="{% url 'by_year_bank' accounting_year.0 'bank' %}">Bancaire</a></td>
<td class="centered"><a href="{% url 'by_year_box' accounting_year.0 'box' %}">Caisse</a></td>
<td class="centered"><a href="{% url 'export_simple' accounting_year.0 %}">export</a></td>
</tr>
{% endfor %}
</table>

View File

@ -16,7 +16,7 @@
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<p align="right" class="noprint">
<a href="{% url 'annualcomptability:by_year' accounting_year %}">Listing</a> | <a href="{% url 'annualcomptability:export' accounting_year 'sxs' %}">1 tableau</a> | <a href="{% url 'annualcomptability:export_simple' accounting_year %}">Export SPF</a>
<a href="{% url 'by_year' accounting_year %}">Listing</a> | <a href="{% url 'export' accounting_year 'sxs' %}">1 tableau</a> | <a href="{% url 'export_simple' accounting_year %}">Export SPF</a>
</p>
</div>
</div>
@ -32,7 +32,7 @@
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<p align="center" class="noprint">
<a href="{% url 'annualcomptability:by_year' accounting_year %}">Listing</a> | <a href="{% url 'annualcomptability:export' accounting_year 'sxs' %}">Affichage 1 tableau</a> | <a href="{% url 'annualcomptability:export_simple' accounting_year %}">Export SPF</a>
<a href="{% url 'by_year' accounting_year %}">Listing</a> | <a href="{% url 'export' accounting_year 'sxs' %}">Affichage 1 tableau</a> | <a href="{% url 'export_simple' accounting_year %}">Export SPF</a>
</p>
</div>
</div>

View File

@ -16,7 +16,7 @@
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<p align="right" class="noprint">
<a href="{% url 'annualcomptability:by_year' accounting_year %}">Listing</a> | <a href="{% url 'annualcomptability:export' accounting_year 'sxs' %}">1 tableau</a> | <a href="{% url 'annualcomptability:export' accounting_year 'ooo' %}">2 tableaux</a>
<a href="{% url 'by_year' accounting_year %}">Listing</a> | <a href="{% url 'export' accounting_year 'sxs' %}">1 tableau</a> | <a href="{% url 'export' accounting_year 'ooo' %}">2 tableaux</a>
</p>
</div>
</div>

View File

@ -17,7 +17,7 @@
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<p align="right" class="noprint">
<a href="{% url 'annualcomptability:by_year' accounting_year %}">Listing</a> | <a href="{% url 'annualcomptability:export' accounting_year 'ooo' %}">2 tableaux</a> | <a href="{% url 'annualcomptability:export_simple' accounting_year %}">Export SPF</a>
<a href="{% url 'by_year' accounting_year %}">Listing</a> | <a href="{% url 'export' accounting_year 'ooo' %}">2 tableaux</a> | <a href="{% url 'export_simple' accounting_year %}">Export SPF</a>
</p>
</div>
</div>
@ -101,7 +101,7 @@
</tfoot>
</table>
<br>
<p align="center" class="noprint"><a href="{% url 'annualcomptability:by_year' accounting_year %}">Listing</a> | <a href="{% url 'annualcomptability:export' accounting_year 'ooo' %}">Affichage 2 tableaux</a> | <a href="{% url 'annualcomptability:export_simple' accounting_year %}">Affichage 1 tableaux simplifié</a></p>
<p align="center" class="noprint"><a href="{% url 'by_year' accounting_year %}">Listing</a> | <a href="{% url 'export' accounting_year 'ooo' %}">Affichage 2 tableaux</a> | <a href="{% url 'export_simple' accounting_year %}">Affichage 1 tableaux simplifié</a></p>
<br>
</div>
</div>

View File

@ -14,7 +14,7 @@
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<p align="right" class="noprint">
<a href="{% url 'annualcomptability:export' accounting_year 'sxs' %}">1 tableau</a> | <a href="{% url 'annualcomptability:export' accounting_year 'ooo' %}">2 tableaux</a> | <a href="{% url 'annualcomptability:export_simple' accounting_year %}">Export SPF</a>
<a href="{% url 'export' accounting_year 'sxs' %}">1 tableau</a> | <a href="{% url 'export' accounting_year 'ooo' %}">2 tableaux</a> | <a href="{% url 'export_simple' accounting_year %}">Export SPF</a>
</p>
</div>
</div>
@ -40,7 +40,7 @@
<tr {% if transaction.0.is_done == False %}class="alert alert-danger"{% elif transaction.0.is_simulated == True %}class="alert alert-warning simulated"{% endif %}>
<td class="centered">{{ transaction.0.id }}</td>
<td class="push-right">{{ transaction.0.registrationDate | date:"d-m-Y" }}</td>
<td><a href="{% url 'annualcomptability:compta_details' transaction.0.id %}">{{ transaction.0.description }}</a></td>
<td><a href="{% url 'compta_details' transaction.0.id %}">{{ transaction.0.description }}</a></td>
{% if transaction.0.transaction_type.transaction_type == 0 %}
<td>&nbsp;</td>
<td class="push-right alert alert-danger">-{{ transaction.0.totalAmount }}</td>