2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 04:00:57 +00:00

Add StockItemAttachment model

This commit is contained in:
Oliver Walters
2020-05-07 09:39:28 +10:00
parent e83a0610af
commit 64f6238351
3 changed files with 51 additions and 2 deletions

View File

@ -27,7 +27,7 @@ from datetime import datetime
from InvenTree import helpers
from InvenTree.status_codes import StockStatus
from InvenTree.models import InvenTreeTree
from InvenTree.models import InvenTreeTree, InvenTreeAttachment
from InvenTree.fields import InvenTreeURLField
from part import models as PartModels
@ -935,6 +935,21 @@ def before_delete_stock_item(sender, instance, using, **kwargs):
StockItem.objects.rebuild()
class StockItemAttachment(InvenTreeAttachment):
"""
Model for storing file attachments against a StockItem object.
"""
def getSubdir(self):
return os.path.join("stock_files", str(self.stock_item.id))
stock_item = models.ForeignKey(
StockItem,
on_delete=models.CASCADE,
related_name='attachments'
)
class StockItemTracking(models.Model):
""" Stock tracking entry - breacrumb for keeping track of automated stock transactions