2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-09 07:00:56 +00:00

Add a reference to a build for a stock item

This commit is contained in:
Oliver Walters
2019-09-01 23:09:40 +10:00
parent c63d40bd88
commit 90a342fad8
2 changed files with 28 additions and 0 deletions

View File

@ -101,6 +101,7 @@ class StockItem(models.Model):
delete_on_deplete: If True, StockItem will be deleted when the stock level gets to zero
status: Status of this StockItem (ref: InvenTree.status_codes.StockStatus)
notes: Extra notes field
build: Link to a Build (if this stock item was created from a build)
purchase_order: Link to a PurchaseOrder (if this stock item was created from a PurchaseOrder)
infinite: If True this StockItem can never be exhausted
"""
@ -300,6 +301,13 @@ class StockItem(models.Model):
updated = models.DateField(auto_now=True, null=True)
build = models.ForeignKey(
'build.Build', on_delete=models.SET_NULL,
blank=True, null=True,
help_text='Build for this stock item',
related_name='build_outputs',
)
purchase_order = models.ForeignKey(
'order.PurchaseOrder',
on_delete=models.SET_NULL,