Small fixes

This commit is contained in:
Alexis Métaireau 2020-11-21 14:59:18 +01:00
parent e839422bf6
commit 55abec8488
3 changed files with 8 additions and 47 deletions

View file

@ -67,7 +67,7 @@ def full(delivery):
ws.append(row) ws.append(row)
footer = ( footer = (
["Total", "", ""] ["Total", "", ""]
+ [round(o.total(delivery.products), 2) for o in delivery.orders.values()] + [round(o.total(delivery.products, delivery), 2) for o in delivery.orders.values()]
+ [round(delivery.total, 2)] + [round(delivery.total, 2)]
) )
footer.insert(1, "") footer.insert(1, "")

View file

@ -4,7 +4,6 @@
<div class="header"> <div class="header">
<h1>Copier les produits d'une autre distribution</h1> <h1>Copier les produits d'une autre distribution</h1>
</div> </div>
<form method="post"> <form method="post">
<label> <label>
<p>Distribution à copier</p> <p>Distribution à copier</p>
@ -14,6 +13,8 @@
{% endfor %} {% endfor %}
</select> </select>
</label> </label>
<div><strong>Attention !! Copier les produits d'une autre distribution remplacera l'ensemble des producteurs et des produits actuels.</strong></div>
<div> <div>
<input type="submit" name="submit" value="Valider" class="primary"> <input type="submit" name="submit" value="Valider" class="primary">
</div> </div>

View file

@ -23,41 +23,9 @@ async def home(request, response):
"delivery/list_deliveries.html", "delivery/list_deliveries.html",
incoming=Delivery.incoming(), incoming=Delivery.incoming(),
former=Delivery.former(), former=Delivery.former(),
archives=list(Delivery.archived()),
) )
@app.route("/archives", methods=["GET"])
async def list_archives(request, response):
response.html(
"delivery/list_archives.html", {"deliveries": Delivery.archived()}
)
@app.route("/distribution/archive/{id}", methods=["GET"])
async def view_archive(request, response, id):
delivery = Delivery.load(f"archive/{id}")
response.html("delivery/show_delivery.html", {"delivery": delivery})
@app.route("/distribution/{id}/archiver", methods=["GET"])
@staff_only
async def archive_delivery(request, response, id):
delivery = Delivery.load(id)
delivery.archive()
response.message("La distribution a été archivée")
response.redirect = f"/distribution/{delivery.id}"
@app.route("/distribution/archive/{id}/désarchiver", methods=["GET"])
@staff_only
async def unarchive_delivery(request, response, id):
delivery = Delivery.load(f"archive/{id}")
delivery.unarchive()
response.message("La distribution a été désarchivée")
response.redirect = f"/distribution/{delivery.id}"
@app.route("/distribution", methods=["GET"]) @app.route("/distribution", methods=["GET"])
async def new_delivery(request, response): async def new_delivery(request, response):
response.html("delivery/edit_delivery.html", delivery={}) response.html("delivery/edit_delivery.html", delivery={})
@ -330,7 +298,6 @@ async def adjust_product(request, response, id, ref):
@app.route("/distribution/{id}/paiements", methods=["GET"]) @app.route("/distribution/{id}/paiements", methods=["GET"])
@app.route("/distribution/{id}/paiements.pdf", methods=["GET"])
@staff_only @staff_only
async def compute_payments(request, response, id): async def compute_payments(request, response, id):
delivery = Delivery.load(id) delivery = Delivery.load(id)
@ -384,11 +351,4 @@ async def compute_payments(request, response, id):
"crediters_groups": producer_groups, "crediters_groups": producer_groups,
} }
if request.url.endswith(b".pdf"):
response.pdf(
template_name,
template_args,
filename=utils.prefix("répartition-des-chèques.pdf", delivery),
)
else:
response.html(template_name, template_args) response.html(template_name, template_args)