mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix for triggered events
This commit is contained in:
parent
936330d3d2
commit
5acd880f39
@ -587,11 +587,16 @@ class Build(MPTTModel, ReferenceIndexingMixin):
|
|||||||
# which point to thie Build Order
|
# which point to thie Build Order
|
||||||
self.allocated_stock.all().delete()
|
self.allocated_stock.all().delete()
|
||||||
|
|
||||||
|
if user:
|
||||||
|
user_id = user.pk
|
||||||
|
else:
|
||||||
|
user_id = None
|
||||||
|
|
||||||
# Register an event
|
# Register an event
|
||||||
trigger_event(
|
trigger_event(
|
||||||
'build.completed',
|
'build.completed',
|
||||||
build_id=self.pk,
|
build_id=self.pk,
|
||||||
user_id=user.pk,
|
user_id=user_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
@ -613,10 +618,15 @@ class Build(MPTTModel, ReferenceIndexingMixin):
|
|||||||
self.status = BuildStatus.CANCELLED
|
self.status = BuildStatus.CANCELLED
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
if user:
|
||||||
|
user_id = user.pk
|
||||||
|
else:
|
||||||
|
user_id = None
|
||||||
|
|
||||||
trigger_event(
|
trigger_event(
|
||||||
'build.cancelled',
|
'build.cancelled',
|
||||||
build_id=self.pk,
|
build_id=self.pk,
|
||||||
user_id=user.pk,
|
user_id=user_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
|
Loading…
Reference in New Issue
Block a user