mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 12:35:46 +00:00
Simplify event triggering
- add generic receivers for database actions - exclude django_q tables, otherwise we get an infinite loop! Ref: https://stackoverflow.com/questions/17507784/consolidating-multiple-post-save-signals-with-one-receiver/32230933#32230933
This commit is contained in:
@ -470,15 +470,6 @@ class PurchaseOrder(Order):
|
||||
self.complete_order() # This will save the model
|
||||
|
||||
|
||||
@receiver(post_save, sender=PurchaseOrder, dispatch_uid='po_post_save_log')
|
||||
def after_save_po(sender, instance: PurchaseOrder, created: bool, **kwargs):
|
||||
|
||||
if created:
|
||||
trigger_event('purchaseorder.created', order_id=instance.pk)
|
||||
else:
|
||||
trigger_event('purchasesorder.saved', order_id=instance.pk)
|
||||
|
||||
|
||||
class SalesOrder(Order):
|
||||
"""
|
||||
A SalesOrder represents a list of goods shipped outwards to a customer.
|
||||
@ -772,15 +763,6 @@ class SalesOrder(Order):
|
||||
return self.pending_shipments().count()
|
||||
|
||||
|
||||
@receiver(post_save, sender=SalesOrder, dispatch_uid='so_post_save_log')
|
||||
def after_save_so(sender, instance: SalesOrder, created: bool, **kwargs):
|
||||
|
||||
if created:
|
||||
trigger_event('salesorder.created', order_id=instance.pk)
|
||||
else:
|
||||
trigger_event('salesorder.saved', order_id=instance.pk)
|
||||
|
||||
|
||||
class PurchaseOrderAttachment(InvenTreeAttachment):
|
||||
"""
|
||||
Model for storing file attachments against a PurchaseOrder object
|
||||
|
Reference in New Issue
Block a user