mirror of
https://github.com/almet/copanier.git
synced 2025-04-28 19:42:37 +02:00
Merge branch 'skip-empty' into 'master'
Skip products without orders in order form See merge request ybon/copanier!7
This commit is contained in:
commit
2f331d981e
4 changed files with 5 additions and 4 deletions
|
@ -359,7 +359,7 @@ async def import_commande(request, response, id):
|
|||
response.redirect = f"/livraison/{delivery.id}"
|
||||
|
||||
|
||||
@app.route("/livraison/{id}/rapport.xlsx", methods=["GET"])
|
||||
@app.route("/livraison/{id}/bon-de-commande.xlsx", methods=["GET"])
|
||||
async def xls_report(request, response, id):
|
||||
delivery = Delivery.load(id)
|
||||
response.xlsx(reports.summary(delivery))
|
||||
|
|
|
@ -21,6 +21,8 @@ def summary(delivery):
|
|||
ws.append(headers)
|
||||
for product in delivery.products:
|
||||
wanted = delivery.product_wanted(product)
|
||||
if not wanted:
|
||||
continue
|
||||
ws.append(
|
||||
[
|
||||
product.ref,
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<hr>
|
||||
<ul class="toolbox">
|
||||
<li>
|
||||
<a href="/livraison/{{ delivery.id }}/rapport.xlsx"><i class="icon-ribbon"></i> Bon de commande</a>
|
||||
<a href="/livraison/{{ delivery.id }}/bon-de-commande.xlsx"><i class="icon-ribbon"></i> Bon de commande</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/livraison/{{ delivery.id }}/rapport-complet.xlsx"><i class="icon-grid"></i> Rapport complet</a>
|
||||
|
|
|
@ -6,7 +6,7 @@ from copanier import reports
|
|||
from copanier.models import Order, Product, ProductOrder
|
||||
|
||||
|
||||
def test_export_products(client, delivery):
|
||||
def test_summary_report(client, delivery):
|
||||
delivery.products[0].packing = 6
|
||||
delivery.products.append(
|
||||
Product(ref="456", name="yaourt", price="3.5", packing=4, unit="pot 125ml")
|
||||
|
@ -21,6 +21,5 @@ def test_export_products(client, delivery):
|
|||
("ref", "produit", "prix unitaire", "quantité commandée", "unité", "total"),
|
||||
("123", "Lait", 1.5, 1, None, 1.5),
|
||||
("456", "yaourt (pot 125ml)", 3.5, 4, "pot 125ml", 14),
|
||||
("789", "fromage", 9.2, 0, None, 0),
|
||||
(None, None, None, None, "Total", 15.5),
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue