2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 12:06:44 +00:00

Add a stock item transaction when installing items into a build output

This commit is contained in:
Oliver Walters 2022-04-28 22:58:58 +10:00
parent f531e354b9
commit b63352ce20

View File

@ -1260,7 +1260,7 @@ class BuildItem(models.Model):
}) })
@transaction.atomic @transaction.atomic
def complete_allocation(self, user): def complete_allocation(self, user, notes=''):
""" """
Complete the allocation of this BuildItem into the output stock item. Complete the allocation of this BuildItem into the output stock item.
@ -1286,8 +1286,13 @@ class BuildItem(models.Model):
self.save() self.save()
# Install the stock item into the output # Install the stock item into the output
item.belongs_to = self.install_into self.install_into.installStockItem(
item.save() item,
self.quantity,
user,
notes
)
else: else:
# Simply remove the items from stock # Simply remove the items from stock
item.take_stock( item.take_stock(