From 7f36837f59d37a60597211a517f260c6842306e8 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 21 Feb 2023 21:22:57 +1100 Subject: [PATCH] Improve template efficiency for build page --- InvenTree/build/templates/build/detail.html | 10 +++++----- InvenTree/build/views.py | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/InvenTree/build/templates/build/detail.html b/InvenTree/build/templates/build/detail.html index f7d57b8288..76b2f13801 100644 --- a/InvenTree/build/templates/build/detail.html +++ b/InvenTree/build/templates/build/detail.html @@ -67,7 +67,7 @@ {% trans "Completed" %} {% progress_bar build.completed build.quantity id='build-completed-2' max_width='150px' %} - {% if build.active and build.has_untracked_bom_items %} + {% if build.active and has_untracked_bom_items %} {% trans "Allocated Parts" %} @@ -179,7 +179,7 @@

{% trans "Allocate Stock to Build" %}

{% include "spacer.html" %}
- {% if roles.build.add and build.active and build.has_untracked_bom_items %} + {% if roles.build.add and build.active and has_untracked_bom_items %} @@ -199,7 +199,7 @@
- {% if build.has_untracked_bom_items %} + {% if has_untracked_bom_items %} {% if build.active %} {% if build.are_untracked_parts_allocated %}
@@ -281,7 +281,7 @@
- {% if build.has_tracked_bom_items %} + {% if has_tracked_bom_items %} {% include "expand_rows.html" with label="outputs" %} {% include "collapse_rows.html" with label="outputs" %} {% endif %} @@ -436,7 +436,7 @@ onPanelLoad('outputs', function() { {% endif %} }); -{% if build.active and build.has_untracked_bom_items %} +{% if build.active and has_untracked_bom_items %} function loadUntrackedStockTable() { diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py index bccd1b31e6..4de664d2a1 100644 --- a/InvenTree/build/views.py +++ b/InvenTree/build/views.py @@ -34,15 +34,11 @@ class BuildDetail(InvenTreeRoleMixin, InvenTreePluginViewMixin, DetailView): build = self.get_object() - ctx['bom_price'] = build.part.get_price_info(build.quantity, buy=False) ctx['BuildStatus'] = BuildStatus - ctx['sub_build_count'] = build.sub_build_count() part = build.part - bom_items = build.bom_items ctx['part'] = part - ctx['bom_items'] = bom_items ctx['has_tracked_bom_items'] = build.has_tracked_bom_items() ctx['has_untracked_bom_items'] = build.has_untracked_bom_items()