diff --git a/Web/app.py b/Web/app.py index 43695e9..742ed38 100755 --- a/Web/app.py +++ b/Web/app.py @@ -9135,9 +9135,14 @@ def library_item_invoices(item_id): flash('Bibliotheksmedium nicht gefunden.', 'error') return redirect(url_for('library_loans_admin')) + # Hole die ID sowohl als ObjectId als auch als String + item_id_obj = item_doc.get('_id') + item_id_str = str(item_id_obj) + borrow_docs = list(ausleihungen.find( { - 'Item': str(item_doc.get('_id')), + # $in sucht nach Treffern, egal ob die ID als String oder ObjectId in der DB steht + 'Item': {'$in': [item_id_str, item_id_obj]}, 'InvoiceData': {'$exists': True, '$ne': {}} }, {