From cb12222e17a11524583e4d74f09032bcfea24876 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 26 Apr 2022 19:23:41 +1000 Subject: [PATCH] Re-enable the "pricing" tab - Previously was gated entirely on the "PART_SHOW_PRICE_HISTORY" setting --- InvenTree/part/templates/part/detail.html | 3 +-- InvenTree/part/templates/part/part_sidebar.html | 3 +-- InvenTree/part/templates/part/prices.html | 11 ++++++++--- InvenTree/part/views.py | 6 +++++- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 2f13faab8a..a996151879 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -124,8 +124,7 @@ -{% settings_value "PART_SHOW_PRICE_HISTORY" as show_price_history %} -{% if show_price_history %} +{% if part.purchaseable or part.salable %}
{% include "part/prices.html" %}
diff --git a/InvenTree/part/templates/part/part_sidebar.html b/InvenTree/part/templates/part/part_sidebar.html index 3c1c647f86..e8763fb973 100644 --- a/InvenTree/part/templates/part/part_sidebar.html +++ b/InvenTree/part/templates/part/part_sidebar.html @@ -4,7 +4,6 @@ {% settings_value "PART_INTERNAL_PRICE" as show_internal_price %} {% settings_value 'PART_SHOW_RELATED' as show_related %} -{% settings_value "PART_SHOW_PRICE_HISTORY" as show_price_history %} {% trans "Parameters" as text %} {% include "sidebar_item.html" with label="part-parameters" text=text icon="fa-th-list" %} @@ -28,7 +27,7 @@ {% trans "Used In" as text %} {% include "sidebar_item.html" with label="used-in" text=text icon="fa-layer-group" %} {% endif %} -{% if show_price_history %} +{% if part.purchaseable or part.salable %} {% trans "Pricing" as text %} {% include "sidebar_item.html" with label="pricing" text=text icon="fa-dollar-sign" %} {% endif %} diff --git a/InvenTree/part/templates/part/prices.html b/InvenTree/part/templates/part/prices.html index 9b829c179b..53723b729b 100644 --- a/InvenTree/part/templates/part/prices.html +++ b/InvenTree/part/templates/part/prices.html @@ -3,6 +3,9 @@ {% load crispy_forms_tags %} {% load inventree_extras %} +{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %} + +{% if show_price_history %}

{% trans "Pricing Information" %}

@@ -43,7 +46,7 @@ {% endif %} {% endif %} - {% if part.bom_count > 0 %} + {% if part.assembly and part.bom_count > 0 %} {% if min_total_bom_price %} {% trans 'BOM Pricing' %} @@ -147,7 +150,7 @@ -{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %} +{% endif %} {% if part.purchaseable and roles.purchase_order.view %} @@ -170,7 +173,7 @@ -{% if price_history %} +{% if show_price_history %}

{% trans "Purchase Price" %} @@ -279,6 +282,7 @@

+{% if show_price_history %}

{% trans "Sale Price" %} @@ -298,3 +302,4 @@ {% endif %}

{% endif %} +{% endif %} diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 9f3cd07f7c..ab4b3fec72 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -389,8 +389,12 @@ class PartDetail(InvenTreeRoleMixin, DetailView): context.update(**ctx) + show_price_history = InvenTreeSetting.get_setting('PART_SHOW_PRICE_HISTORY', False) + + context['show_price_history'] = show_price_history + # Pricing information - if InvenTreeSetting.get_setting('PART_SHOW_PRICE_HISTORY', False): + if show_price_history: ctx = self.get_pricing(self.get_quantity()) ctx['form'] = self.form_class(initial=self.get_initials())