From b32a6b50d29bcda2cbc8bbeaaa28ef854100138c Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 20 Jun 2021 20:16:14 +0200 Subject: [PATCH 1/3] fixes #1671 --- InvenTree/stock/templates/stock/item_base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index fa91177bf6..7aebd51452 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -325,7 +325,7 @@ {{ item.purchase_order }} {% endif %} - {% if item.purchase_price %} + {% if item.purchase_price != None %} {% trans "Purchase Price" %} From 59aae516528dcb1fa742616373ba2fc2abedc0e3 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 20 Jun 2021 20:17:01 +0200 Subject: [PATCH 2/3] show stock history starting by 1 element --- InvenTree/part/templates/part/order_prices.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/part/templates/part/order_prices.html b/InvenTree/part/templates/part/order_prices.html index a9da632a33..5e5552c5f9 100644 --- a/InvenTree/part/templates/part/order_prices.html +++ b/InvenTree/part/templates/part/order_prices.html @@ -137,7 +137,7 @@

{% trans 'Stock Pricing' %}

- {% if price_history|length > 1 %} + {% if price_history|length > 0 %}
From a0b83d530cb51738969617e7edc810c13ce137a8 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 20 Jun 2021 20:19:11 +0200 Subject: [PATCH 3/3] refactor --- InvenTree/part/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index b68c889516..39e0f13b45 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -814,7 +814,7 @@ class PartPricingView(PartDetail): part = self.get_part() # Stock history if part.total_stock > 1: - ret = [] + price_history = [] stock = part.stock_entries(include_variants=False, in_stock=True) # .order_by('purchase_order__date') stock = stock.prefetch_related('purchase_order', 'supplier_part') @@ -841,9 +841,9 @@ class PartPricingView(PartDetail): line['date'] = stock_item.purchase_order.issue_date.strftime('%d.%m.%Y') else: line['date'] = stock_item.tracking_info.first().date.strftime('%d.%m.%Y') - ret.append(line) + price_history.append(line) - ctx['price_history'] = ret + ctx['price_history'] = price_history # BOM Information for Pie-Chart if part.has_bom: