This commit is contained in:
@@ -270,7 +270,9 @@ def get_contract_recap(
|
|||||||
filename = f'{form.name}_recapitulatif_contrats.ods'
|
filename = f'{form.name}_recapitulatif_contrats.ods'
|
||||||
recap = generate_recap(contracts, form)
|
recap = generate_recap(contracts, form)
|
||||||
if recap is None:
|
if recap is None:
|
||||||
raise HTTPException(status_code=404)
|
raise HTTPException(
|
||||||
|
status_code=404, detail=messages.Messages.not_found('contracts')
|
||||||
|
)
|
||||||
return StreamingResponse(
|
return StreamingResponse(
|
||||||
io.BytesIO(recap),
|
io.BytesIO(recap),
|
||||||
media_type='application/vnd.oasis.opendocument.spreadsheet',
|
media_type='application/vnd.oasis.opendocument.spreadsheet',
|
||||||
|
|||||||
@@ -424,8 +424,8 @@ def generate_recap(
|
|||||||
key=lambda x: x.product.name
|
key=lambda x: x.product.name
|
||||||
)
|
)
|
||||||
recurrents = [
|
recurrents = [
|
||||||
f'{pr.name}{f' - {pr.quantity}{pr.quantity_unit}'
|
f'{pr.product.name}{f' - {pr.product.quantity}{pr.product.quantity_unit}'
|
||||||
if pr.quantity else ''} ({product_unit_map[pr.unit]})'
|
if pr.product.quantity else ''} ({product_unit_map[pr.product.unit]})'
|
||||||
for pr in reccurents_sorted
|
for pr in reccurents_sorted
|
||||||
]
|
]
|
||||||
occasionnals_sorted = sorted(
|
occasionnals_sorted = sorted(
|
||||||
@@ -436,8 +436,8 @@ def generate_recap(
|
|||||||
key=lambda x: (x.shipment.name, x.product.name)
|
key=lambda x: (x.shipment.name, x.product.name)
|
||||||
)
|
)
|
||||||
occasionnals = [
|
occasionnals = [
|
||||||
f'{pr.name}{f' - {pr.quantity}{pr.quantity_unit}'
|
f'{pr.product.name}{f' - {pr.product.quantity}{pr.product.quantity_unit}'
|
||||||
if pr.quantity else ''} ({product_unit_map[pr.unit]})'
|
if pr.product.quantity else ''} ({product_unit_map[pr.product.unit]})'
|
||||||
for pr in occasionnals_sorted
|
for pr in occasionnals_sorted
|
||||||
]
|
]
|
||||||
shipments = form.shipments
|
shipments = form.shipments
|
||||||
|
|||||||
Reference in New Issue
Block a user