From f7eff8ae9847f340061d81e19f551c5f2998322b Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 16 Apr 2018 01:25:13 +1000 Subject: [PATCH] Added URL field to UniquePart - e.g. link to external part tracking info page --- InvenTree/part/templates/part/stock.html | 4 ---- InvenTree/track/forms.py | 1 + .../track/migrations/0005_uniquepart_url.py | 20 +++++++++++++++++++ InvenTree/track/models.py | 3 +++ InvenTree/track/templates/track/detail.html | 16 +++++++-------- 5 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 InvenTree/track/migrations/0005_uniquepart_url.py diff --git a/InvenTree/part/templates/part/stock.html b/InvenTree/part/templates/part/stock.html index 825608b73f..2d04fd9a14 100644 --- a/InvenTree/part/templates/part/stock.html +++ b/InvenTree/part/templates/part/stock.html @@ -4,10 +4,6 @@ {% include 'part/tabs.html' with tab='stock' %} -
-Total in stock: {{ part.stock }} -
- diff --git a/InvenTree/track/forms.py b/InvenTree/track/forms.py index cfcc50dd4b..7ac159a510 100644 --- a/InvenTree/track/forms.py +++ b/InvenTree/track/forms.py @@ -22,6 +22,7 @@ class EditTrackedPartForm(forms.ModelForm): fields = [ 'part', 'serial', + 'URL', 'customer', 'status' ] diff --git a/InvenTree/track/migrations/0005_uniquepart_url.py b/InvenTree/track/migrations/0005_uniquepart_url.py new file mode 100644 index 0000000000..50ea92eaa6 --- /dev/null +++ b/InvenTree/track/migrations/0005_uniquepart_url.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2018-04-15 15:21 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('track', '0004_parttrackinginfo_user'), + ] + + operations = [ + migrations.AddField( + model_name='uniquepart', + name='URL', + field=models.URLField(blank=True), + ), + ] diff --git a/InvenTree/track/models.py b/InvenTree/track/models.py index d43193e392..8df03994a1 100644 --- a/InvenTree/track/models.py +++ b/InvenTree/track/models.py @@ -28,6 +28,9 @@ class UniquePart(models.Model): serial = models.PositiveIntegerField() + # Provide a URL for an external link + URL = models.URLField(blank=True) + # createdBy = models.ForeignKey(User) customer = models.ForeignKey(Customer, blank=True, null=True) diff --git a/InvenTree/track/templates/track/detail.html b/InvenTree/track/templates/track/detail.html index 1a7488be6f..6626cd4b49 100644 --- a/InvenTree/track/templates/track/detail.html +++ b/InvenTree/track/templates/track/detail.html @@ -17,6 +17,12 @@ + {% if part.URL %} + + + + + {% endif %} {% if part.customer %} @@ -34,14 +40,8 @@
LinkCreation Date {{ part.creation_date }}
URL{{ part.URL }}
Customer