updated print module

This commit is contained in:
2025-09-17 22:45:54 +03:00
parent 18a1c638e1
commit dfc60a9725
4 changed files with 291 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ from app.settings import (
delete_user_handler,
save_external_db_handler
)
from .print_module import get_unprinted_orders_data
bp = Blueprint('main', __name__)
warehouse_bp = Blueprint('warehouse', __name__)
@@ -1148,6 +1149,19 @@ def view_orders():
orders = get_orders_from_database(200) # Get last 200 orders
return render_template('view_orders.html', orders=orders)
@bp.route('/get_unprinted_orders', methods=['GET'])
def get_unprinted_orders():
"""Get all rows from order_for_labels where printed != 1"""
if 'role' not in session or session['role'] not in ['superadmin', 'warehouse_manager', 'etichete']:
return jsonify({'error': 'Access denied'}), 403
try:
data = get_unprinted_orders_data()
return jsonify(data)
except Exception as e:
return jsonify({'error': str(e)}), 500
@warehouse_bp.route('/create_locations', methods=['GET', 'POST'])
def create_locations():
from app.warehouse import create_locations_handler