mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-06 05:30:56 +00:00
Add an API serializer to complete build outputs
This commit is contained in:
@ -722,7 +722,7 @@ class Build(MPTTModel):
|
||||
items.all().delete()
|
||||
|
||||
@transaction.atomic
|
||||
def completeBuildOutput(self, output, user, **kwargs):
|
||||
def complete_build_output(self, output, user, **kwargs):
|
||||
"""
|
||||
Complete a particular build output
|
||||
|
||||
@ -739,10 +739,6 @@ class Build(MPTTModel):
|
||||
allocated_items = output.items_to_install.all()
|
||||
|
||||
for build_item in allocated_items:
|
||||
|
||||
# TODO: This is VERY SLOW as each deletion from the database takes ~1 second to complete
|
||||
# TODO: Use the background worker process to handle this task!
|
||||
|
||||
# Complete the allocation of stock for that item
|
||||
build_item.complete_allocation(user)
|
||||
|
||||
@ -768,6 +764,7 @@ class Build(MPTTModel):
|
||||
|
||||
# Increase the completed quantity for this build
|
||||
self.completed += output.quantity
|
||||
|
||||
self.save()
|
||||
|
||||
def requiredQuantity(self, part, output):
|
||||
|
Reference in New Issue
Block a user