1
0
forked from erp-dev/erp

feat: added custom signal for pre sales order created

This commit is contained in:
2026-01-31 23:58:40 +08:00
parent f643b643b7
commit a633a617d5
5 changed files with 173 additions and 0 deletions

21
business/signals.py Normal file
View File

@@ -0,0 +1,21 @@
"""business domain signals.
We use domain-level signals (instead of model post_save) to:
- keep semantics clean (only fire on business "create" flow)
- allow passing explicit actor (created_by / operator)
- keep integrations in handlers
NOTE:
Signals should be triggered via transaction.on_commit to avoid firing when a
transaction rolls back.
"""
from django.dispatch import Signal
# Fired when a PreSalesOrder (and its items) is created via service layer.
# Payload:
# - instance: PreSalesOrder
# - created_by: Django User (may be None)
# - operator: Employee (may be None)
# - items_count: int
pre_sales_order_created = Signal()