Ajouter les vues FDS et etiquettes des produits
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run

This commit is contained in:
root 2026-08-21 14:16:44 +00:00
parent 374e5e5a54
commit 68a8ce2aad
4 changed files with 20 additions and 0 deletions

View file

@ -12,6 +12,7 @@ from ..core.models import (
StockLocation, StockLot, StockLotBalance, StockMovement, Staff,
RequestProfile, StockInventory, StockInventoryLine,
Equipment, MaterialAssignment,
ProductDocument,
)
from .services.stock import StockError, receive_stock, issue_stock, transfer_stock, transvasement, dilute
from .services.forecast import forecast_product
@ -84,6 +85,22 @@ def product_edit(id):
def references():
return render_template("cleaning/references.html", references=CommercialProduct.query.order_by(CommercialProduct.commercial_name).all(), products=ProductGeneric.query.order_by(ProductGeneric.name).all())
@cleaning_bp.route("/documents")
@login_required
def documents():
return render_template("cleaning/documents.html", documents=ProductDocument.query.order_by(ProductDocument.uploaded_at.desc()).all())
@cleaning_bp.route("/labels/<int:movement_id>")
@login_required
def label(movement_id):
movement = StockMovement.query.get_or_404(movement_id)
if not movement.lot or not movement.commercial_product:
flash("Impossible de générer une étiquette : lot ou référence commerciale manquant.", "danger")
return redirect(url_for("cleaning.movements"))
return render_template("cleaning/label.html", movement=movement)
@cleaning_bp.route("/references/new", methods=["GET", "POST"])
@login_required
def reference_new():

View file

@ -0,0 +1 @@
{% extends "base.html" %}{% block title %}FDS et fiches techniques{% endblock %}{% block content %}<div class="container-fluid"><h1>Documents produits</h1><p class="text-muted">Les documents sont conservés par version ; les mentions CLP sont saisies depuis les documents officiels.</p><table class="table"><tr><th>Référence</th><th>Type</th><th>Titre</th><th>Version</th><th>Date</th></tr>{% for d in documents %}<tr><td>{{ d.commercial_product.commercial_name }}</td><td>{{ d.document_type|upper }}</td><td>{{ d.title }}</td><td>{{ d.version or '—' }}</td><td>{{ d.published_at or '—' }}</td></tr>{% else %}<tr><td colspan="5">Aucun document.</td></tr>{% endfor %}</table></div>{% endblock %}

View file

@ -0,0 +1 @@
{% extends "base.html" %}{% block title %}Étiquette{% endblock %}{% block content %}<div class="container"><div class="border border-dark p-4" style="max-width:500px"><h2>{{ movement.generic_product.name }}</h2><h5>{{ movement.commercial_product.commercial_name }}</h5><p>Préparé le : {{ movement.created_at|datetime_fmt }}<br>Lot source : {{ movement.lot.lot_number }}<br>Quantité : {{ (-movement.quantity_reference) }} {{ movement.generic_product.reference_unit }}</p>{% if movement.commercial_product.pictograms %}<p><strong>Pictogrammes configurés :</strong> {{ movement.commercial_product.pictograms }}</p>{% endif %}{% if movement.commercial_product.warning_statement %}<p><strong>{{ movement.commercial_product.warning_statement }}</strong></p>{% endif %}<p>{{ movement.commercial_product.required_ppe or 'EPI non renseignés — compléter depuis la FDS officielle.' }}</p></div><button class="btn btn-primary mt-3 d-print-none" onclick="window.print()">Imprimer</button></div>{% endblock %}

View file

@ -225,6 +225,7 @@
<li><a class="dropdown-item" href="{{ url_for('cleaning.dashboard') }}"><i class="bi bi-droplet-half"></i> Matériel &amp; Entretien</a></li>
<li><a class="dropdown-item" href="{{ url_for('cleaning.products') }}"><i class="bi bi-flask"></i> Produits génériques</a></li>
<li><a class="dropdown-item" href="{{ url_for('cleaning.references') }}"><i class="bi bi-upc-scan"></i> Références / conditionnements</a></li>
<li><a class="dropdown-item" href="{{ url_for('cleaning.documents') }}"><i class="bi bi-file-earmark-text"></i> FDS / fiches techniques</a></li>
<li><a class="dropdown-item" href="{{ url_for('cleaning.stock') }}"><i class="bi bi-boxes"></i> État du stock</a></li>
<li><a class="dropdown-item" href="{{ url_for('cleaning.receive') }}"><i class="bi bi-box-arrow-in-down"></i> Réceptions</a></li>
<li><a class="dropdown-item" href="{{ url_for('cleaning.issue') }}"><i class="bi bi-box-arrow-up"></i> Sorties agents</a></li>