2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 12:06:44 +00:00

Added 'part tracking' page

- e.g. /part/<pk>/track
This commit is contained in:
Oliver 2018-04-14 00:46:18 +10:00
parent eec725d90f
commit 63f7fe640c
9 changed files with 38 additions and 6 deletions

View File

@ -49,8 +49,8 @@ INSTALLED_APPS = [
'bom.apps.BomConfig', 'bom.apps.BomConfig',
'supplier.apps.SupplierConfig', 'supplier.apps.SupplierConfig',
'stock.apps.StockConfig', 'stock.apps.StockConfig',
'track.apps.TrackConfig',
#'project.apps.ProjectConfig', #'project.apps.ProjectConfig',
#'track.apps.TrackConfig',
] ]
MIDDLEWARE = [ MIDDLEWARE = [

View File

@ -9,4 +9,10 @@ Used in {{ part.usedInCount }} other parts.<br>
<a href="{% url 'stock' part.id %}">There are {{ part.stock }} units in stock.</a> <a href="{% url 'stock' part.id %}">There are {{ part.stock }} units in stock.</a>
<br><br>
{% if part.trackable %}
<a href="{% url 'track' part.id %}">Part tracking</a>
{% else %}
{{ part.name }} does not have part tracking enabled
{% endif %}
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "part/base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}

View File

@ -1,4 +1,4 @@
{% extends "part/base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}

View File

@ -0,0 +1,20 @@
{% extends "part/part_base.html" %}
{% block details %}
Part tracking for {{ part.name }}
<table>
<tr>
<th>Serial</th>
<th>Status</th>
</tr>
{% for track in part.serials.all %}
<tr>
<td>{{ track.serial }}</td>
<td>{{ track.status }}</td>
</tr>
{% endfor %}
</table>
{% endblock %}

View File

@ -29,7 +29,7 @@ part_api_urls = [
] ]
part_detail_urls = [ part_detail_urls = [
url(r'^track/?', views.track, name='track'),
url(r'^bom/?', views.bom, name='bom'), url(r'^bom/?', views.bom, name='bom'),
url(r'^stock/?', views.stock, name='stock'), url(r'^stock/?', views.stock, name='stock'),
url('', views.detail, name='detail'), url('', views.detail, name='detail'),

View File

@ -74,6 +74,11 @@ def stock(request, pk):
return render(request, 'part/stock.html', {'part': part}) return render(request, 'part/stock.html', {'part': part})
def track(request, pk):
part = get_object_or_404(Part, pk=pk)
return render(request, 'part/track.html', {'part': part})
#def results(request, question_id): #def results(request, question_id):
# response = "You're looking at the results of question %s." # response = "You're looking at the results of question %s."

View File

@ -32,11 +32,12 @@ class UniquePart(models.Model):
# Cannot have multiple parts with same serial number # Cannot have multiple parts with same serial number
unique_together = ('part', 'serial') unique_together = ('part', 'serial')
part = models.ForeignKey(Part, on_delete=models.CASCADE) part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='serials')
creation_date = models.DateField(auto_now_add=True, creation_date = models.DateField(auto_now_add=True,
editable=False) editable=False)
serial = models.IntegerField()
serial = models.PositiveIntegerField()
# createdBy = models.ForeignKey(User) # createdBy = models.ForeignKey(User)