1
0
forked from erp-dev/erp

feat: fix setting

This commit is contained in:
2026-03-20 20:18:30 +08:00
parent 96cc67706a
commit fa9721762c
3 changed files with 41 additions and 8 deletions

View File

@@ -326,15 +326,13 @@ def on_printing_order_created(sender, **kwargs):
except Exception:
logger.exception("[printing.handlers] 发送 WeCom webhook 失败(已忽略,不影响主流程)")
# Just for testing
# ==============================================================
try:
from flower.utils import play_speech
if getattr(settings, "PRINTING_ORDER_CREATED_SPEECH_ENABLED", False):
try:
from flower.utils import play_speech
play_speech(text=f"生产订单 {order_id} 已创建")
except Exception:
logger.exception("[printing.handlers] 发送语音播报失败(已忽略,不影响主流程)")
# ===================================
play_speech(text=f"生产订单 {order_id} 已创建")
except Exception:
logger.exception("[printing.handlers] 发送语音播报失败(已忽略,不影响主流程)")
# 在事务提交后再发送,避免事务回滚但通知已发出
transaction.on_commit(_send_wecom)