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:
parent
f531e354b9
commit
b63352ce20
@ -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(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user