Re-enable the "pricing" tab

- Previously was gated entirely on the "PART_SHOW_PRICE_HISTORY" setting
This commit is contained in:
Oliver Walters 2022-04-26 19:23:41 +10:00
parent 4c6c618af6
commit cb12222e17
4 changed files with 15 additions and 8 deletions

View File

@ -124,8 +124,7 @@
</div> </div>
</div> </div>
{% settings_value "PART_SHOW_PRICE_HISTORY" as show_price_history %} {% if part.purchaseable or part.salable %}
{% if show_price_history %}
<div class='panel panel-hidden' id='panel-pricing'> <div class='panel panel-hidden' id='panel-pricing'>
{% include "part/prices.html" %} {% include "part/prices.html" %}
</div> </div>

View File

@ -4,7 +4,6 @@
{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %} {% settings_value "PART_INTERNAL_PRICE" as show_internal_price %}
{% settings_value 'PART_SHOW_RELATED' as show_related %} {% settings_value 'PART_SHOW_RELATED' as show_related %}
{% settings_value "PART_SHOW_PRICE_HISTORY" as show_price_history %}
{% trans "Parameters" as text %} {% trans "Parameters" as text %}
{% include "sidebar_item.html" with label="part-parameters" text=text icon="fa-th-list" %} {% include "sidebar_item.html" with label="part-parameters" text=text icon="fa-th-list" %}
@ -28,7 +27,7 @@
{% trans "Used In" as text %} {% trans "Used In" as text %}
{% include "sidebar_item.html" with label="used-in" text=text icon="fa-layer-group" %} {% include "sidebar_item.html" with label="used-in" text=text icon="fa-layer-group" %}
{% endif %} {% endif %}
{% if show_price_history %} {% if part.purchaseable or part.salable %}
{% trans "Pricing" as text %} {% trans "Pricing" as text %}
{% include "sidebar_item.html" with label="pricing" text=text icon="fa-dollar-sign" %} {% include "sidebar_item.html" with label="pricing" text=text icon="fa-dollar-sign" %}
{% endif %} {% endif %}

View File

@ -3,6 +3,9 @@
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% load inventree_extras %} {% load inventree_extras %}
{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %}
{% if show_price_history %}
<div class='panel-heading'> <div class='panel-heading'>
<h4>{% trans "Pricing Information" %}</h4> <h4>{% trans "Pricing Information" %}</h4>
</div> </div>
@ -43,7 +46,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if part.bom_count > 0 %} {% if part.assembly and part.bom_count > 0 %}
{% if min_total_bom_price %} {% if min_total_bom_price %}
<tr> <tr>
<td><strong>{% trans 'BOM Pricing' %}</strong> <td><strong>{% trans 'BOM Pricing' %}</strong>
@ -147,7 +150,7 @@
</div> </div>
</div> </div>
{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %} {% endif %}
{% if part.purchaseable and roles.purchase_order.view %} {% if part.purchaseable and roles.purchase_order.view %}
<a class="anchor" id="supplier-cost"></a> <a class="anchor" id="supplier-cost"></a>
@ -170,7 +173,7 @@
</div> </div>
</div> </div>
{% if price_history %} {% if show_price_history %}
<a class="anchor" id="purchase-price"></a> <a class="anchor" id="purchase-price"></a>
<div class='panel-heading'> <div class='panel-heading'>
<h4>{% trans "Purchase Price" %} <h4>{% trans "Purchase Price" %}
@ -279,6 +282,7 @@
</div> </div>
</div> </div>
{% if show_price_history %}
<a class="anchor" id="sale-price"></a> <a class="anchor" id="sale-price"></a>
<div class='panel-heading'> <div class='panel-heading'>
<h4>{% trans "Sale Price" %} <h4>{% trans "Sale Price" %}
@ -298,3 +302,4 @@
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% endif %}

View File

@ -389,8 +389,12 @@ class PartDetail(InvenTreeRoleMixin, DetailView):
context.update(**ctx) context.update(**ctx)
show_price_history = InvenTreeSetting.get_setting('PART_SHOW_PRICE_HISTORY', False)
context['show_price_history'] = show_price_history
# Pricing information # Pricing information
if InvenTreeSetting.get_setting('PART_SHOW_PRICE_HISTORY', False): if show_price_history:
ctx = self.get_pricing(self.get_quantity()) ctx = self.get_pricing(self.get_quantity())
ctx['form'] = self.form_class(initial=self.get_initials()) ctx['form'] = self.form_class(initial=self.get_initials())