mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Added 'track' app
- Keeping track of UniquePart objects
This commit is contained in:
parent
af679a1ac6
commit
f17e9de37b
@ -40,7 +40,8 @@ INSTALLED_APPS = [
|
||||
|
||||
'part.apps.PartConfig',
|
||||
'stock.apps.StockConfig',
|
||||
'supplier.apps.SupplierConfig'
|
||||
'supplier.apps.SupplierConfig',
|
||||
'track.apps.TrackConfig'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
@ -13,6 +13,7 @@ Including another URLconf
|
||||
1. Import the include() function: from django.conf.urls import url, include
|
||||
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
|
||||
"""
|
||||
|
||||
from django.conf.urls import url, include
|
||||
from django.contrib import admin
|
||||
|
||||
@ -22,5 +23,6 @@ urlpatterns = [
|
||||
url(r'^stock/', include('stock.urls')),
|
||||
url(r'^part/', include('part.urls')),
|
||||
url(r'^supplier/', include('supplier.urls')),
|
||||
url(r'^track/', include('track.urls')),
|
||||
url(r'^admin/', admin.site.urls),
|
||||
]
|
||||
|
0
InvenTree/track/__init__.py
Normal file
0
InvenTree/track/__init__.py
Normal file
5
InvenTree/track/admin.py
Normal file
5
InvenTree/track/admin.py
Normal file
@ -0,0 +1,5 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import UniquePart
|
||||
|
||||
admin.site.register(UniquePart)
|
7
InvenTree/track/apps.py
Normal file
7
InvenTree/track/apps.py
Normal file
@ -0,0 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class TrackConfig(AppConfig):
|
||||
name = 'track'
|
32
InvenTree/track/models.py
Normal file
32
InvenTree/track/models.py
Normal file
@ -0,0 +1,32 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from part.models import Part
|
||||
|
||||
class UniquePart(models.Model):
|
||||
""" A unique instance of a Part object.
|
||||
Used for tracking parts based on serial numbers,
|
||||
and tracking all events in the life of a part
|
||||
"""
|
||||
|
||||
part = models.ForeignKey(Part, on_delete=models.CASCADE)
|
||||
created = models.DateField(auto_now_add=True,
|
||||
editable=False)
|
||||
serial = models.IntegerField()
|
||||
|
||||
createdBy = models.ForeignKey(User)
|
||||
|
||||
class PartTrackingInfo(models.Model):
|
||||
""" Single data-point in the life of a UniquePart
|
||||
Each time something happens to the UniquePart,
|
||||
a new PartTrackingInfo object should be created.
|
||||
"""
|
||||
|
||||
part = models.ForeignKey(UniquePart, on_delete=models.CASCADE)
|
||||
date = models.DateField(auto_now_add=True,
|
||||
editable=False)
|
||||
notes = models.CharField(max_length=500)
|
||||
|
||||
|
3
InvenTree/track/tests.py
Normal file
3
InvenTree/track/tests.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
3
InvenTree/track/views.py
Normal file
3
InvenTree/track/views.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
Loading…
Reference in New Issue
Block a user