From b6b701b07769af13126bcfb31228efc499c22f18 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 25 Feb 2023 18:58:59 +1100 Subject: [PATCH] Improve rendering efficiency for build detail page (#4416) - Remove pre-calculated context data (which is not used) --- InvenTree/build/templates/build/detail.html | 8 ++++---- InvenTree/build/views.py | 4 ---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/InvenTree/build/templates/build/detail.html b/InvenTree/build/templates/build/detail.html index 3b0585d0c0..d7999cec76 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 %}
@@ -431,7 +431,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()