diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py
index bc2ca4214b..7a2a91dea3 100644
--- a/InvenTree/common/models.py
+++ b/InvenTree/common/models.py
@@ -209,6 +209,13 @@ class InvenTreeSetting(models.Model):
'validator': bool,
},
+ 'PART_SHOW_GRAPH': {
+ 'name': _('Show Price History Graph'),
+ 'description': _('Display the price history graph in the part pricing view'),
+ 'default': False,
+ 'validator': bool,
+ },
+
'REPORT_DEBUG_MODE': {
'name': _('Debug Mode'),
'description': _('Generate reports in debug mode (HTML output)'),
diff --git a/InvenTree/part/settings.py b/InvenTree/part/settings.py
index 801b4dd2ec..a3913caa95 100644
--- a/InvenTree/part/settings.py
+++ b/InvenTree/part/settings.py
@@ -62,3 +62,11 @@ def part_trackable_default():
"""
return InvenTreeSetting.get_setting('PART_TRACKABLE')
+
+
+def part_show_graph():
+ """
+ Returns if the part pricing graph should be shown
+ """
+
+ return InvenTreeSetting.get_setting('PART_SHOW_GRAPH')
diff --git a/InvenTree/part/templates/part/part_pricing.html b/InvenTree/part/templates/part/part_pricing.html
index d0dc7f58c9..b07be7bdba 100644
--- a/InvenTree/part/templates/part/part_pricing.html
+++ b/InvenTree/part/templates/part/part_pricing.html
@@ -1,8 +1,11 @@
{% extends "modal_form.html" %}
{% load i18n %}
+{% load inventree_extras %}
{% block pre_form_content %}
+{% settings_value "PART_SHOW_GRAPH" as show_graph %}
+
{% blocktrans %}Pricing information for:
{{part}}.{% endblocktrans %}
@@ -77,7 +80,7 @@
{% endif %}
- {% if price_history %}
+ {% if show_graph and price_history %}
{% trans 'Stock Pricing' %}
{% if price_history|length > 1 %}
diff --git a/InvenTree/part/test_part.py b/InvenTree/part/test_part.py
index 030d7faf4e..67fca7fc29 100644
--- a/InvenTree/part/test_part.py
+++ b/InvenTree/part/test_part.py
@@ -212,6 +212,7 @@ class PartSettingsTest(TestCase):
self.assertFalse(part.settings.part_purchaseable_default())
self.assertFalse(part.settings.part_salable_default())
self.assertFalse(part.settings.part_trackable_default())
+ self.assertFalse(part.settings.part_show_graph())
def test_initial(self):
"""
diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py
index 8787a14b35..8113a52993 100644
--- a/InvenTree/part/views.py
+++ b/InvenTree/part/views.py
@@ -41,6 +41,7 @@ from common.models import InvenTreeSetting
from company.models import SupplierPart
import common.settings as inventree_settings
+import part.settings as part_settings
from . import forms as part_forms
from .bom import MakeBomTemplate, BomUploadManager, ExportBom, IsValidBOMFormat
@@ -2034,7 +2035,7 @@ class PartPricing(AjaxView):
ctx['max_unit_bom_price'] = max_bom_price / quantity
# Stock history
- if part.total_stock > 1:
+ if part_settings.part_show_graph and part.total_stock > 1:
ret = []
stock = part.stock_entries(include_variants=False, in_stock=True)
diff --git a/InvenTree/templates/InvenTree/settings/part.html b/InvenTree/templates/InvenTree/settings/part.html
index 092d9c576c..a25fdbbcf6 100644
--- a/InvenTree/templates/InvenTree/settings/part.html
+++ b/InvenTree/templates/InvenTree/settings/part.html
@@ -21,6 +21,7 @@
{% include "InvenTree/settings/setting.html" with key="PART_ALLOW_EDIT_IPN" %}
{% include "InvenTree/settings/setting.html" with key="PART_SHOW_QUANTITY_IN_FORMS" icon="fa-hashtag" %}
{% include "InvenTree/settings/setting.html" with key="PART_RECENT_COUNT" icon="fa-clock" %}
+ {% include "InvenTree/settings/setting.html" with key="PART_SHOW_GRAPH" icon="fa-chart-bar" %}
|
{% include "InvenTree/settings/setting.html" with key="PART_TEMPLATE" icon="fa-clone" %}
{% include "InvenTree/settings/setting.html" with key="PART_ASSEMBLY" icon="fa-tools" %}