2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-07 12:22:11 +00:00

added setting -> default false

This commit is contained in:
2021-04-22 12:05:48 +02:00
parent c6b0bdf0fb
commit a0154067d2
6 changed files with 23 additions and 2 deletions

View File

@@ -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')

View File

@@ -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 %}
<div class='alert alert-info alert-block'>
{% blocktrans %}Pricing information for:<br>{{part}}.{% endblocktrans %}
</div>
@@ -77,7 +80,7 @@
</table>
{% endif %}
{% if price_history %}
{% if show_graph and price_history %}
<h4>{% trans 'Stock Pricing' %}</h4>
{% if price_history|length > 1 %}
<canvas id="priceChart"></canvas>

View File

@@ -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):
"""

View File

@@ -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)