1
0
forked from erp-dev/erp
This commit is contained in:
2026-01-13 18:51:28 +08:00
parent 5e6834358d
commit 70e98704dc
3 changed files with 27 additions and 0 deletions

View File

@@ -1,5 +1,8 @@
import logging
from django.apps import AppConfig
logger = logging.getLogger(__name__)
class PrintingConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
@@ -16,4 +19,9 @@ class PrintingConfig(AppConfig):
process_completed.connect(
handlers.on_printing_job_process_completed,
sender=PrintingJob
)
logger.info(
f'[printing.apps] 已注册 process_completed 信号处理器, '
f'sender={PrintingJob}, handler={handlers.on_printing_job_process_completed}'
)

View File

@@ -33,6 +33,11 @@ def on_printing_job_process_completed(sender, **kwargs):
"""
from shipment.models import SalesItem, UnitChoices
logger.info(
f'[printing.handlers] 收到 process_completed 信号: '
f'sender={sender}, kwargs keys={list(kwargs.keys())}'
)
content_object = kwargs.get('content_object')
business_object = kwargs.get('business_object')
last_completed_by = kwargs.get('last_completed_by')
@@ -42,6 +47,7 @@ def on_printing_job_process_completed(sender, **kwargs):
return
printing_job = content_object
logger.info(f'[printing.handlers] 处理 PrintingJob #{printing_job.id}')
# 从 settings 获取配置
source_state_id = getattr(settings, 'PRINTING_SALES_ITEM_SOURCE_STATE_ID', None)