From fd8273e3e230c0335572c62e6840d3047a7ab217 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 12 Apr 2020 00:31:59 +1000 Subject: [PATCH] Improve build base rendering - Consolidate style - Fix rendering of part pricing --- .../build/templates/build/build_base.html | 110 ++++++++++-------- InvenTree/part/models.py | 9 ++ .../part/templates/part/stock_count.html | 4 +- 3 files changed, 71 insertions(+), 52 deletions(-) diff --git a/InvenTree/build/templates/build/build_base.html b/InvenTree/build/templates/build/build_base.html index cd9ae463c2..2538cafc8b 100644 --- a/InvenTree/build/templates/build/build_base.html +++ b/InvenTree/build/templates/build/build_base.html @@ -24,60 +24,70 @@ InvenTree | Build - {{ build }}
-

Build Details

-

-

-
- - {% if build.is_active %} - - - {% endif %} - {% if build.status == BuildStatus.CANCELLED %} - - {% endif %} -
+

{% trans "Build" %}

+
+
+ + {% if build.is_active %} + + + {% endif %} + {% if build.status == BuildStatus.CANCELLED %} + + {% endif %}
-

- - - - - - - - - - - - - - - - - - -
{{ build.title }}{% build_status build.status %}
Part{{ build.part.full_name }}
Quantity{{ build.quantity }}
BOM Price - {% if bom_price %} - {{ bom_price }} - {% if build.part.has_complete_bom_pricing == False %} -
BOM pricing is incomplete - {% endif %} - {% else %} - No pricing information - {% endif %} -
+
+
+

{% trans "Build Details" %}

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
{% trans "Build Title" %}{{ build.title }}
Part{{ build.part.full_name }}
{% trans "Quantity" %}{{ build.quantity }}
{% trans "Status" %}{% build_status build.status %}
{% trans "BOM Price" %} + {% if bom_price %} + {{ bom_price }} + {% if build.part.has_complete_bom_pricing == False %} +
BOM pricing is incomplete + {% endif %} + {% else %} + No pricing information + {% endif %} +
+
+
diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index f9151fb1f0..f1caf32fe6 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -781,6 +781,9 @@ class Part(models.Model): if min_price == max_price: return min_price + min_price = min_price.normalize() + max_price = max_price.normalize() + return "{a} - {b}".format(a=min_price, b=max_price) def get_supplier_price_range(self, quantity=1): @@ -804,6 +807,9 @@ class Part(models.Model): if min_price is None or max_price is None: return None + min_price = min_price.normalize() + max_price = max_price.normalize() + return (min_price, max_price) def get_bom_price_range(self, quantity=1): @@ -837,6 +843,9 @@ class Part(models.Model): if min_price is None or max_price is None: return None + min_price = min_price.normalize() + max_price = max_price.normalize() + return (min_price, max_price) def get_price_range(self, quantity=1, buy=True, bom=True): diff --git a/InvenTree/part/templates/part/stock_count.html b/InvenTree/part/templates/part/stock_count.html index 07b3ac9c9b..58e447b051 100644 --- a/InvenTree/part/templates/part/stock_count.html +++ b/InvenTree/part/templates/part/stock_count.html @@ -4,7 +4,7 @@ {% decimal part.total_stock %} {% if part.total_stock == 0 %} -{% trans "No Stock" %} +{% trans "No Stock" %} {% elif part.total_stock < part.minimum_stock %} -{% trans "Low Stock" %} +{% trans "Low Stock" %} {% endif %} \ No newline at end of file