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