diff --git a/brewman/brewman/routers/purchase.py b/brewman/brewman/routers/purchase.py index 63b9ae8a..cc6d9be7 100644 --- a/brewman/brewman/routers/purchase.py +++ b/brewman/brewman/routers/purchase.py @@ -285,12 +285,9 @@ def update_inventory(voucher: Voucher, vendor_id: uuid.UUID, inventories: List[I db.flush() fix_single_batch_prices(item.batch_id, db) else: - has_been_issued: int = ( - db.execute( - select(func.count(Inventory.id)).where(Inventory.batch_id == item.batch.id, Inventory.id != item.id) - ) - .scalar_one() - ) + has_been_issued: int = db.execute( + select(func.count(Inventory.id)).where(Inventory.batch_id == item.batch.id, Inventory.id != item.id) + ).scalar_one() if has_been_issued > 0: raise HTTPException( status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, diff --git a/brewman/brewman/routers/reports/raw_material_cost.py b/brewman/brewman/routers/reports/raw_material_cost.py index d19bafe4..38768a22 100644 --- a/brewman/brewman/routers/reports/raw_material_cost.py +++ b/brewman/brewman/routers/reports/raw_material_cost.py @@ -117,11 +117,12 @@ def build_report( sale=sale, rmc=rmc, url=["/", "raw-material-cost", str(cost_centre.id)], + order=0, ) ) rmc = 0 if sales == 0 else issues / sales - return body, schemas.RawMaterialCostItem(name="Total", issue=issues, sale=sales, rmc=rmc) + return body, schemas.RawMaterialCostItem(name="Total", issue=issues, sale=sales, rmc=rmc, order=0) def build_report_id(