From 789712acbe2e848b1ee96795718acebc26b0b7b6 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 6 Apr 2020 11:28:35 +1000 Subject: [PATCH] Rename Build.URL -> Build.link --- InvenTree/build/fixtures/build.yaml | 1 + InvenTree/build/forms.py | 2 +- .../migrations/0011_auto_20200406_0123.py | 18 ++++++++++ InvenTree/build/models.py | 4 +-- InvenTree/build/serializers.py | 4 ++- InvenTree/build/templates/build/detail.html | 33 ++++++++++++++----- InvenTree/part/fixtures/part.yaml | 1 + 7 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 InvenTree/build/migrations/0011_auto_20200406_0123.py diff --git a/InvenTree/build/fixtures/build.yaml b/InvenTree/build/fixtures/build.yaml index d0fc30755a..c46afe625c 100644 --- a/InvenTree/build/fixtures/build.yaml +++ b/InvenTree/build/fixtures/build.yaml @@ -9,6 +9,7 @@ notes: 'Some simple notes' status: 10 # PENDING creation_date: '2019-03-16' + link: http://www.google.com - model: build.build fields: diff --git a/InvenTree/build/forms.py b/InvenTree/build/forms.py index 4f9384d34e..e060ff644d 100644 --- a/InvenTree/build/forms.py +++ b/InvenTree/build/forms.py @@ -25,7 +25,7 @@ class EditBuildForm(HelperForm): 'quantity', 'take_from', 'batch', - 'URL', + 'link', ] diff --git a/InvenTree/build/migrations/0011_auto_20200406_0123.py b/InvenTree/build/migrations/0011_auto_20200406_0123.py new file mode 100644 index 0000000000..ba081c5e13 --- /dev/null +++ b/InvenTree/build/migrations/0011_auto_20200406_0123.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.10 on 2020-04-06 01:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('build', '0010_auto_20200318_1027'), + ] + + operations = [ + migrations.RenameField( + model_name='build', + old_name='URL', + new_name='link', + ), + ] diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index dae5789493..8730fd6700 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -38,7 +38,7 @@ class Build(models.Model): batch: Batch code transferred to build parts (optional) creation_date: Date the build was created (auto) completion_date: Date the build was completed - URL: External URL for extra information + link: External URL for extra information notes: Text notes """ @@ -94,7 +94,7 @@ class Build(models.Model): related_name='builds_completed' ) - URL = InvenTreeURLField(blank=True, help_text=_('Link to external URL')) + link = InvenTreeURLField(blank=True, help_text=_('Link to external URL')) notes = MarkdownxField(blank=True, help_text=_('Extra build notes')) diff --git a/InvenTree/build/serializers.py b/InvenTree/build/serializers.py index a7bb61a5cc..3eb3aee5be 100644 --- a/InvenTree/build/serializers.py +++ b/InvenTree/build/serializers.py @@ -30,7 +30,9 @@ class BuildSerializer(InvenTreeModelSerializer): 'quantity', 'status', 'status_text', - 'notes'] + 'notes', + 'link', + ] read_only_fields = [ 'status', diff --git a/InvenTree/build/templates/build/detail.html b/InvenTree/build/templates/build/detail.html index 3c3be79b56..4011ca7dfb 100644 --- a/InvenTree/build/templates/build/detail.html +++ b/InvenTree/build/templates/build/detail.html @@ -11,15 +11,21 @@ - + + + - + + + + + - + + + {% if build.batch %} - + + + {% endif %} -{% if build.URL %} +{% if build.link %} - + + + {% endif %} - + + + {% if build.is_active %} + - + + + {% endif %}
{% trans "Title" %}{{ build.title }}{% trans "Title" %}{{ build.title }}
{% trans "Part" %}{{ build.part.full_name }}{% trans "Part" %}{{ build.part.full_name }}
{% trans "Quantity" %}{{ build.quantity }}
{% trans "Stock Source" %} {% if build.take_from %} @@ -30,23 +36,32 @@
{% trans "Status" %}{% include "build_status.html" with build=build %}{% trans "Status" %}{% include "build_status.html" with build=build %}
{% trans "Batch" %}{{ build.batch }}{% trans "Batch" %}{{ build.batch }}
{% trans "URL" %}{{ build.URL }}{% trans "External Link" %}{{ build.link }}
{% trans "Created" %}{{ build.creation_date }}{% trans "Created" %}{{ build.creation_date }}
{% trans "Enough Parts?" %} {% if build.can_build %} @@ -59,7 +74,9 @@ {% endif %} {% if build.completion_date %}
{% trans "Completed" %}{{ build.completion_date }}{% if build.completed_by %}{{ build.completed_by }}{% endif %}{% trans "Completed" %}{{ build.completion_date }}{% if build.completed_by %}{{ build.completed_by }}{% endif %}
diff --git a/InvenTree/part/fixtures/part.yaml b/InvenTree/part/fixtures/part.yaml index 8f4963cbad..117763be84 100644 --- a/InvenTree/part/fixtures/part.yaml +++ b/InvenTree/part/fixtures/part.yaml @@ -6,6 +6,7 @@ name: 'M2x4 LPHS' description: 'M2x4 low profile head screw' category: 8 + link: www.acme.com/parts/m2x4lphs - model: part.part pk: 2