2
0
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:
Oliver
2021-10-14 23:13:01 +11:00
parent 4b4bf38ae5
commit 54dd05a24d
8 changed files with 153 additions and 63 deletions

View File

@ -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):