mirror of
https://github.com/inventree/InvenTree.git
synced 2026-05-28 11:59:23 +00:00
Tweak order of operations
This commit is contained in:
@@ -700,11 +700,6 @@ class Build(
|
|||||||
_('Cannot complete build order with incomplete outputs')
|
_('Cannot complete build order with incomplete outputs')
|
||||||
)
|
)
|
||||||
|
|
||||||
self.completion_date = InvenTree.helpers.current_date()
|
|
||||||
self.completed_by = user
|
|
||||||
self.status = BuildStatus.COMPLETE.value
|
|
||||||
self.save()
|
|
||||||
|
|
||||||
# Offload background task to complete build allocations
|
# Offload background task to complete build allocations
|
||||||
InvenTree.tasks.offload_task(
|
InvenTree.tasks.offload_task(
|
||||||
build.tasks.complete_build,
|
build.tasks.complete_build,
|
||||||
@@ -714,6 +709,11 @@ class Build(
|
|||||||
group='build',
|
group='build',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.completion_date = InvenTree.helpers.current_date()
|
||||||
|
self.completed_by = user
|
||||||
|
self.status = BuildStatus.COMPLETE.value
|
||||||
|
self.save()
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def issue_build(self):
|
def issue_build(self):
|
||||||
"""Mark the Build as IN PRODUCTION.
|
"""Mark the Build as IN PRODUCTION.
|
||||||
@@ -791,13 +791,6 @@ class Build(
|
|||||||
remove_allocated_stock = kwargs.get('remove_allocated_stock', False)
|
remove_allocated_stock = kwargs.get('remove_allocated_stock', False)
|
||||||
remove_incomplete_outputs = kwargs.get('remove_incomplete_outputs', False)
|
remove_incomplete_outputs = kwargs.get('remove_incomplete_outputs', False)
|
||||||
|
|
||||||
# Date of 'completion' is the date the build was cancelled
|
|
||||||
self.completion_date = InvenTree.helpers.current_date()
|
|
||||||
self.completed_by = user
|
|
||||||
|
|
||||||
self.status = BuildStatus.CANCELLED.value
|
|
||||||
self.save()
|
|
||||||
|
|
||||||
# Offload background task to take care of the expensive operations
|
# Offload background task to take care of the expensive operations
|
||||||
InvenTree.tasks.offload_task(
|
InvenTree.tasks.offload_task(
|
||||||
build.tasks.cancel_build,
|
build.tasks.cancel_build,
|
||||||
@@ -808,6 +801,13 @@ class Build(
|
|||||||
group='build',
|
group='build',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Date of 'completion' is the date the build was cancelled
|
||||||
|
self.completion_date = InvenTree.helpers.current_date()
|
||||||
|
self.completed_by = user
|
||||||
|
|
||||||
|
self.status = BuildStatus.CANCELLED.value
|
||||||
|
self.save()
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def deallocate_stock(self, build_line=None, output=None):
|
def deallocate_stock(self, build_line=None, output=None):
|
||||||
"""Deallocate stock from this Build.
|
"""Deallocate stock from this Build.
|
||||||
|
|||||||
Reference in New Issue
Block a user