Fix bugs (spacename in url) and minor improvement in transactions display

This commit is contained in:
Gregory Trullemans 2022-04-18 19:43:56 +02:00
parent 306d9d8ec0
commit 0c6845c99a
24 changed files with 37 additions and 35 deletions

View File

@ -46,7 +46,7 @@ def client_listing(request):
""" Récupère la liste de tous les clients. """
client_list = Client.objects.all()
context = {"client_list": client_list}
return render(request, "client_listing.html", context)
return render(request, "billing/clients/listing.html", context)
def client_details(request, client_id=None):
@ -57,7 +57,7 @@ def client_details(request, client_id=None):
"""
client = get_object_or_404(Client, pk=client_id)
context = {"client": client}
return render(request, "client_details.html", context)
return render(request, "billing/clients/details.html", context)
# @login_required
@ -79,20 +79,20 @@ def client_create_or_update(request, client_id=None):
if form.is_valid():
client = form.save()
return HttpResponseRedirect(reverse("billing:client_details", args=(client.pk, )))
return HttpResponseRedirect(reverse("client_details", args=(client.pk, )))
else:
form = ClientForm(instance=client)
context = {"form": form, "client_id": client_id}
return render(request, "client_create_or_update.html", context)
return render(request, "billing/client/create.html", context)
def contract_listing(request):
""" Récupère la liste de tous les contrats. """
contract_list = Contract.objects.all()
context = {"contract_list": contract_list}
return render(request, "contract_listing.html", context)
return render(request, "billing/contracts/listing.html", context)
def contract_detail(request, contract_id):
@ -116,7 +116,7 @@ def contract_detail(request, contract_id):
"prestation_count": prestation_count,
"total": total,
}
return render(request, "contract_detail.html", context)
return render(request, "billing/contracts/details.html", context)
# @login_required
@ -138,13 +138,13 @@ def contract_create_or_update(request, contract_id=None):
if form.is_valid():
contract = form.save()
return HttpResponseRedirect(reverse("billing:contract_details", args=(contract.pk, )))
return HttpResponseRedirect(reverse("contract_details", args=(contract.pk, )))
else:
form = ContractForm(instance=contract)
context = {"form": form, "contract_id": contract_id}
return render(request, "contract_create_or_update.html", context)
return render(request, "billing/contracts/create.html", context)
def contract_export(request, contract_id):
@ -193,13 +193,13 @@ def prestation_create_or_update(request, prestation_id=None):
if form.is_valid():
prestation = form.save()
return HttpResponseRedirect(reverse("prestation_details", args=(prestation.pk, )))
return HttpResponseRedirect(reverse("prestation/details", args=(prestation.pk, )))
else:
form = PrestationForm(instance=prestation)
context = {"form": form, "prestation_id": prestation_id}
return render(request, "prestation_create_or_update.html", context)
return render(request, "billing/prestation/create.html", context)
@require_http_methods(["GET"])

View File

@ -72,7 +72,7 @@ def get_transaction_list_for_accountingyear_ooo(request, accounting_year):
"transactions_list_recettes": transactions_list_recettes,
}
return render(request, "year_transaction_export_ooo.html", context)
return render(request, "comptability/year_transaction_export_ooo.html", context)
# def two_table_side_by_side_export(request, accounting_year):
@ -102,7 +102,7 @@ def get_transaction_list_for_accountingyear_sxs(request, accounting_year):
"total_expenses": expenses_transactiontypes_list["total"],
"total_recettes": recettes_transactiontypes_list["total"],
}
return render(request, "year_transaction_export_sxs.html", context)
return render(request, "comptability/year_transaction_export_sxs.html", context)
def export_year_spf_finance(request, accounting_year):
@ -177,7 +177,7 @@ def export_year_spf_finance(request, accounting_year):
"right_engagement_sum": right_engagement_sum,
}
return render(request, "year_transaction_export_spf.html", context)
return render(request, "comptability/year_transaction_export_spf.html", context)
def generate_pdf_for_spf(request, accounting_year):
@ -310,7 +310,7 @@ def transaction_by_year_listing(request, accounting_year, transaction_kind=None)
"nb_transaction": nb_transaction,
"t_type": transaction_kind,
}
return render(request, "year_transaction_listing.html", context)
return render(request, "comptability/year_transaction_listing.html", context)
def year_listing(request):
@ -324,7 +324,7 @@ def year_listing(request):
year_list.append((year.year, Transaction.objects.by_year(year.year).count(),))
context = {"year_list": year_list}
return render(request, "year_listing.html", context)
return render(request, "comptability/year_listing.html", context)
def transaction_listing_for_year_and_type(
@ -369,7 +369,7 @@ def transaction_listing_for_year_and_type(
"total_simulated": total_simulated,
"total": total,
}
return render(request, "transaction_listing.html", context)
return render(request, "comptability/transaction_listing.html", context)
def transaction_details(request, transaction_id):
@ -381,4 +381,4 @@ def transaction_details(request, transaction_id):
"""
transaction = Transaction.objects.get(pk=transaction_id)
context = {"transaction": transaction}
return render(request, "year_transaction_details.html", context)
return render(request, "comptability/year_transaction_details.html", context)

Binary file not shown.

View File

@ -145,7 +145,7 @@ def event_transaction_listing(request, event_id):
"nonsimulated_sum_dépense": nonsimulated_sum_dépense["totalAmount__sum"],
}
return render(request, "event_transaction_listing.html", context)
return render(request, "event/transaction_listing.html", context)
def event_listing(request):
@ -154,7 +154,7 @@ def event_listing(request):
"""
event_list = Event.objects.all().order_by("-datebegin")
context = {"events": event_list}
return render(request, "event_listing.html", context)
return render(request, "event/listing.html", context)
def event_transaction_details(request, transaction_id):
@ -163,4 +163,4 @@ def event_transaction_details(request, transaction_id):
"""
transaction = Transaction.objects.get(pk=transaction_id)
context = {"event": transaction.event, "transaction": transaction}
return render(request, "event_transaction_details.html", context)
return render(request, "event/transaction_details.html", context)

View File

@ -12,9 +12,9 @@
</div>
<div class="row">
<div class="col-md-6 col-lg-6 col-xl-6 col-md-offset-3 col-lg-offset-3 col-xl-offset-3">
<form action="{% if client_id %}{% url 'billing:client_update' client_id %}{% else %}{% url 'billing:client_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire">
<form action="{% if client_id %}{% url 'client_update' client_id %}{% else %}{% url 'client_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire">
{% csrf_token %}
<div class="form-group row ">
<div class="form-group row ">
<label for="id_date" class="col-4 col-sm-2 col-md-2 col-lg-2 col-xl-2 col-form-label">Nom</label>
<div class="col-8 col-sm-6 col-md-4 col-lg-4 col-xl-4 {% if form.name.errors %}has-danger{% endif %}">
{{ form.name }}

View File

@ -22,7 +22,7 @@
</thead>
{% for client in client_list %}
<tr>
<td><a href="{% url 'billing:client_update' client.id %}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>&nbsp;<a href="{% url 'billing:client_details' client.id %}">{{ client.name }}</a></td>
<td><a href="{% url 'client_update' client.id %}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>&nbsp;<a href="{% url 'client_details' client.id %}">{{ client.name }}</a></td>
<td>{% if client.company_number %}{{ client.company_number }}{% endif %}</td>
<td>{{ client.contact }}</td>
<td>{{ client.address }} - {{ client.postal_code }} {{ client.city }}</td>
@ -30,11 +30,11 @@
{% endfor %}
</table>
<p class="text-right">
<a class="btn btn-primary" href="{% url 'billing:client_create' %}">Ajouter Client</a>
<a class="btn btn-primary" href="{% url 'client_create' %}">Ajouter Client</a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -17,11 +17,11 @@
</div>
<div class="row">
<div class="col-md-6 col-l-6 col-xl-6 col-md-offset-3 col-l-offset-3 col-xl-offset-3">
<form action="{% if contract_id %}{% url 'billing:contract_update' contract_id %}{% else %}{% url 'billing:contract_create' %}{% endif %}" method="post" class="form" id="formulaire" name="formulaire">
<form action="{% if contract_id %}{% url 'contract_update' contract_id %}{% else %}{% url 'contract_create' %}{% endif %}" method="post" class="form" id="formulaire" name="formulaire">
{% csrf_token %}
{% for field in form %}
<div class="form-group">
<div class="form-group">
<label for="">{{ field.label_tag }}</label>
{{ field }}
{% if field.errors %}<span class="btn btn-sm btn-danger-outline">{% for error in field.errors %}{{error}}{% endfor %}</span>{% endif %}

View File

@ -43,12 +43,12 @@
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<p class="text-right">
<a href="{% url 'billing:prestation_create' %}" class="btn btn-default btn-primary" role="button">Ajouter prestation</a>
<a href="{% url 'prestation_create' %}" class="btn btn-default btn-primary" role="button">Ajouter prestation</a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -26,7 +26,7 @@
<tr>
<td class="centered">{{ contract.date.year }}</td>
<td class="centered">{{ contract.reference }}</td>
<td><a href="{% url 'billing:contract_update' contract.id %}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>&nbsp;<a href="{% url 'billing:contract_detail' contract.id %}">{{ contract.name }}</a></td>
<td><a href="{% url 'contract_update' contract.id %}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>&nbsp;<a href="{% url 'contract_detail' contract.id %}">{{ contract.name }}</a></td>
<td>{{ contract.client }}</td>
<td class="push-right">{{ contract.advance }}</td>
<td class="push-right">{{ contract.get_prestation.count }}</td>
@ -34,11 +34,11 @@
{% endfor %}
</table>
<p class="text-right">
<a class="btn btn-primary" href="{% url 'billing:contract_create' %}">Nouveau contrat</a>
<a class="btn btn-primary" href="{% url 'contract_create' %}">Nouveau contrat</a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -12,7 +12,7 @@
</div>
<div class="row">
<div class="col-md-6 col-l-6 col-xl-6 col-md-offset-3 col-l-offset-3 col-xl-offset-3">
<form action="{% if prestation_id %}{% url 'billing:prestation_update' prestation_id %}{% else %}{% url 'billing:prestation_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire">
<form action="{% if prestation_id %}{% url 'prestation_update' prestation_id %}{% else %}{% url 'prestation_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire">
{% csrf_token %}
<div class="form-group row ">

View File

@ -28,6 +28,7 @@
<th rowspan="2" class="centered">ID</th>
<th rowspan="2" class="centered">Date</th>
<th rowspan="2">Description</th>
<th rowspan="2" class="centered">Tiers</th>
<th colspan="2" class="centered">Montant</th>
<th rowspan="2" class="centered">Cumul</th>
</tr>
@ -41,6 +42,7 @@
<td class="centered">{{ transaction.0.id }}</td>
<td class="push-right">{{ transaction.0.registrationDate | date:"d-m-Y" }}</td>
<td><a href="{% url 'compta_details' transaction.0.id %}">{{ transaction.0.description }}</a></td>
<td class="push-right">{{ transaction.0.counterpart }}</td>
{% if transaction.0.transaction_type.transaction_type == 0 %}
<td>&nbsp;</td>
<td class="push-right alert alert-danger">-{{ transaction.0.totalAmount }}</td>

View File

@ -24,7 +24,7 @@
{% for line in events %}
<tr class="alert alert-{% if line.is_complete == False %}danger{% else %}success{% endif %}">
<td class="push-right">{{ line.year }}</td>
<td><a href="{% url 'eventcomptability:event_compta_listing' line.id %}/">{{ line }}</a></td>
<td><a href="{% url 'event_compta_listing' line.id %}">{{ line }}</a></td>
<td>{{ line.place }}</td>
<td class="centered">{{ line.datebegin | date:"d b Y" }}</td>
<td class="centered">{{ line.dateend | date:"d b Y" }}</td>

View File

@ -63,7 +63,7 @@
{{ event.to_markdown | safe }}
{% endif %}
<br>
<p align="center" class="noprint"><a href="{% url 'eventcomptability:event_listing' %}">Listing</a></p>
<p align="center" class="noprint"><a href="{% url 'event_listing' %}">Listing</a></p>
<hr>
<div id="plot_graph" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<br>