From b91de1af7b82ea8ee063e15f89fb2824db02d6a2 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 2 May 2019 21:16:20 +1000 Subject: [PATCH 1/4] Separate active / complete / cancelled builds --- .../build/templates/build/build_list.html | 21 ++++++++- InvenTree/build/templates/build/index.html | 43 ++++++++++++------- InvenTree/build/views.py | 4 +- 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/InvenTree/build/templates/build/build_list.html b/InvenTree/build/templates/build/build_list.html index 5720235911..befa01dbea 100644 --- a/InvenTree/build/templates/build/build_list.html +++ b/InvenTree/build/templates/build/build_list.html @@ -1,4 +1,20 @@ +{% extends "collapse.html" %} +{% block collapse_title %} +{{ title }}{{ builds | length }} +{% endblock %} + +{% block collapse_content %} + + + + + + + + + + {% for build in builds %} @@ -6,4 +22,7 @@ -{% endfor %} \ No newline at end of file +{% endfor %} + +
BuildPartQuantityStatus
{{ build.title }}{{ build.quantity }} {% include "build_status.html" with build=build %}
+{% endblock %} \ No newline at end of file diff --git a/InvenTree/build/templates/build/index.html b/InvenTree/build/templates/build/index.html index 553353ed4d..46d3533651 100644 --- a/InvenTree/build/templates/build/index.html +++ b/InvenTree/build/templates/build/index.html @@ -2,28 +2,40 @@ {% load static %} {% block content %} -

Part Builds

-
- +

Active Builds

+ +
+
+ +
- - +
+ + + + + + + + + +{% for build in active %} - - - - + + + + - - - -{% include "build/build_list.html" with builds=builds %} - +{% endfor %}
BuildPartQuantityStatus
BuildPartQuantityStatus{{ build.title }}{{ build.part.name }}{{ build.quantity }}{% include "build_status.html" with build=build %}
+

+{% include "build/build_list.html" with builds=completed title="Completed Builds" collapse_id="complete" %} +

+{% include "build/build_list.html" with builds=cancelled title="Cancelled Builds" collapse_id="cancelled" %} {% include 'modals.html' %} @@ -39,9 +51,10 @@ }); }); - $("#build-table").bootstrapTable({ + $(".build-table").bootstrapTable({ sortable: true, search: true, + formatNoMatches: function() { return 'No builds found'; }, columns: [ { field: 'name', diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py index f7de8a3a54..109ceb3cff 100644 --- a/InvenTree/build/views.py +++ b/InvenTree/build/views.py @@ -33,12 +33,10 @@ class BuildIndex(ListView): context = super(BuildIndex, self).get_context_data(**kwargs).copy() - """ - context['active'] = self.get_queryset().filter(status__in=[Build.PENDING, Build.HOLDING]) + context['active'] = self.get_queryset().filter(status__in=[Build.PENDING,]) context['complete'] = self.get_queryset().filter(status=Build.COMPLETE) context['cancelled'] = self.get_queryset().filter(status=Build.CANCELLED) - """ return context From a0ad95ab281545a126707ea35a5d062557126ac9 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 2 May 2019 21:23:53 +1000 Subject: [PATCH 2/4] Save the date of Build cancellation --- InvenTree/build/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index 79bedd5616..0e0068fdaf 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -133,6 +133,9 @@ class Build(models.Model): for item in self.allocated_stock.all(): item.delete() + # Date of 'completion' is the date the build was cancelled + self.completion_date = datetime.now().date() + self.status = self.CANCELLED self.save() From 1295390b03e82ffaf2e7f5a32dbc0f0d09321dc0 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 2 May 2019 21:28:47 +1000 Subject: [PATCH 3/4] Rendering changes --- InvenTree/build/templates/build/build_list.html | 2 +- InvenTree/build/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/InvenTree/build/templates/build/build_list.html b/InvenTree/build/templates/build/build_list.html index befa01dbea..890dd551b1 100644 --- a/InvenTree/build/templates/build/build_list.html +++ b/InvenTree/build/templates/build/build_list.html @@ -1,7 +1,7 @@ {% extends "collapse.html" %} {% block collapse_title %} -{{ title }}{{ builds | length }} +{{ title }} - {{ builds | length }} {% endblock %} {% block collapse_content %} diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py index 109ceb3cff..7f8ee702bf 100644 --- a/InvenTree/build/views.py +++ b/InvenTree/build/views.py @@ -35,7 +35,7 @@ class BuildIndex(ListView): context['active'] = self.get_queryset().filter(status__in=[Build.PENDING,]) - context['complete'] = self.get_queryset().filter(status=Build.COMPLETE) + context['completed'] = self.get_queryset().filter(status=Build.COMPLETE) context['cancelled'] = self.get_queryset().filter(status=Build.CANCELLED) return context From 0be4ee5d921a097547147792e39c4cb78196e86c Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 2 May 2019 21:29:27 +1000 Subject: [PATCH 4/4] PEP fix --- InvenTree/build/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py index 7f8ee702bf..6d74d2b19b 100644 --- a/InvenTree/build/views.py +++ b/InvenTree/build/views.py @@ -33,7 +33,7 @@ class BuildIndex(ListView): context = super(BuildIndex, self).get_context_data(**kwargs).copy() - context['active'] = self.get_queryset().filter(status__in=[Build.PENDING,]) + context['active'] = self.get_queryset().filter(status__in=[Build.PENDING, ]) context['completed'] = self.get_queryset().filter(status=Build.COMPLETE) context['cancelled'] = self.get_queryset().filter(status=Build.CANCELLED)