From 84e615baf6318278320e7873d72bf8eda154987e Mon Sep 17 00:00:00 2001 From: DXC Date: Thu, 2 Apr 2026 10:44:33 +0800 Subject: [PATCH] fix(warehouse): fix AttributeError by safely extracting existing attribute from SysWarehouseLocation --- inventory-backend/app/api/v1/warehouse.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inventory-backend/app/api/v1/warehouse.py b/inventory-backend/app/api/v1/warehouse.py index ad42d4f..fe48f52 100644 --- a/inventory-backend/app/api/v1/warehouse.py +++ b/inventory-backend/app/api/v1/warehouse.py @@ -176,7 +176,7 @@ def delete_location(location_id): return jsonify({'code': 404, 'msg': '库位不存在', 'data': None}) # 在删除前提取属性,避免 commit 后访问已删除对象 - location_code = location.location_code + deleted_loc_name = location.name # 递归删除所有子库位 def delete_recursive(loc): @@ -193,7 +193,7 @@ def delete_location(location_id): return jsonify({ 'code': 200, 'msg': '删除成功', - 'location_code': location_code + 'deleted_location': deleted_loc_name }) except Exception as e: db.session.rollback()