mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add a stock item transaction when installing items into a build output
This commit is contained in:
parent
f531e354b9
commit
b63352ce20
@ -1260,7 +1260,7 @@ class BuildItem(models.Model):
|
||||
})
|
||||
|
||||
@transaction.atomic
|
||||
def complete_allocation(self, user):
|
||||
def complete_allocation(self, user, notes=''):
|
||||
"""
|
||||
Complete the allocation of this BuildItem into the output stock item.
|
||||
|
||||
@ -1286,8 +1286,13 @@ class BuildItem(models.Model):
|
||||
self.save()
|
||||
|
||||
# Install the stock item into the output
|
||||
item.belongs_to = self.install_into
|
||||
item.save()
|
||||
self.install_into.installStockItem(
|
||||
item,
|
||||
self.quantity,
|
||||
user,
|
||||
notes
|
||||
)
|
||||
|
||||
else:
|
||||
# Simply remove the items from stock
|
||||
item.take_stock(
|
||||
|
Loading…
Reference in New Issue
Block a user