mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
added setting -> default false
This commit is contained in:
parent
c6b0bdf0fb
commit
a0154067d2
@ -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)'),
|
||||
|
@ -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')
|
||||
|
@ -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>
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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" %}
|
||||
<tr><td colspan='5 '></td></tr>
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_TEMPLATE" icon="fa-clone" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="PART_ASSEMBLY" icon="fa-tools" %}
|
||||
|
Loading…
Reference in New Issue
Block a user