fix: capture and persist target object names for delete, outbound, and borrow operations in audit logs

This commit is contained in:
DXC
2026-03-20 15:47:13 +08:00
parent b08bbba718
commit 032479fe38
15 changed files with 54 additions and 21 deletions

View File

@ -280,9 +280,11 @@ class BuyInboundService:
try:
stock = StockBuy.query.get(stock_id)
if not stock: raise ValueError("记录不存在")
# 提前获取物料名称用于审计日志
material_name = stock.material_name
db.session.delete(stock)
db.session.commit()
return True
return material_name
except Exception as e:
db.session.rollback()
raise e