From 8edfada22a7f2244ba39fd16c414b8f885063055 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 22 Aug 2021 22:08:41 +0200 Subject: [PATCH 1/6] adding settings definitions for turning off features --- InvenTree/common/models.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index cf5e44595a..d61ca54b51 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -783,6 +783,44 @@ class InvenTreeSetting(BaseInvenTreeSetting): 'description': _('Prefix value for purchase order reference'), 'default': 'PO', }, + + # enable/diable ui elements + 'BUILD_FUNCTION_ENABLE': { + 'name': _('Enable build'), + 'description': _('Enable build functionally in InvenTree interface'), + 'default': True, + 'validator': bool, + }, + 'BUY_FUNCTION_ENABLE': { + 'name': _('Enable buy'), + 'description': _('Enable buy functionally in InvenTree interface'), + 'default': True, + 'validator': bool, + }, + 'SELL_FUNCTION_ENABLE': { + 'name': _('Enable sell'), + 'description': _('Enable sell functionally in InvenTree interface'), + 'default': True, + 'validator': bool, + }, + 'STOCK_FUNCTION_ENABLE': { + 'name': _('Enable stock'), + 'description': _('Enable stock functionally in InvenTree interface'), + 'default': True, + 'validator': bool, + }, + 'SO_FUNCTION_ENABLE': { + 'name': _('Enable SO'), + 'description': _('Enable SO functionally in InvenTree interface'), + 'default': True, + 'validator': bool, + }, + 'PO_FUNCTION_ENABLE': { + 'name': _('Enable PO'), + 'description': _('Enable PO functionally in InvenTree interface'), + 'default': True, + 'validator': bool, + }, } class Meta: From d4efdf86e5a95ee751123f589536406df921207a Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 22 Aug 2021 22:09:07 +0200 Subject: [PATCH 2/6] new settingsthe settings-page --- .../templates/InvenTree/settings/build.html | 2 ++ InvenTree/templates/InvenTree/settings/po.html | 3 +++ InvenTree/templates/InvenTree/settings/so.html | 3 +++ .../templates/InvenTree/settings/stock.html | 2 ++ InvenTree/templates/navbar.html | 18 ++++++++++++++---- 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/InvenTree/templates/InvenTree/settings/build.html b/InvenTree/templates/InvenTree/settings/build.html index 6d16512a99..897c624a38 100644 --- a/InvenTree/templates/InvenTree/settings/build.html +++ b/InvenTree/templates/InvenTree/settings/build.html @@ -13,6 +13,8 @@ {% include "InvenTree/settings/header.html" %} + {% include "InvenTree/settings/setting.html" with key="BUILD_FUNCTION_ENABLE" icon="fa-check" %} + {% include "InvenTree/settings/setting.html" with key="BUILDORDER_REFERENCE_PREFIX" %} {% include "InvenTree/settings/setting.html" with key="BUILDORDER_REFERENCE_REGEX" %} diff --git a/InvenTree/templates/InvenTree/settings/po.html b/InvenTree/templates/InvenTree/settings/po.html index f8a114bb12..e5d55f227b 100644 --- a/InvenTree/templates/InvenTree/settings/po.html +++ b/InvenTree/templates/InvenTree/settings/po.html @@ -11,6 +11,9 @@
{% include "InvenTree/settings/header.html" %} + {% include "InvenTree/settings/setting.html" with key="PO_FUNCTION_ENABLE" icon="fa-check" %} + {% include "InvenTree/settings/setting.html" with key="BUY_FUNCTION_ENABLE" icon="fa-check" %} + {% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_REFERENCE_PREFIX" %}
diff --git a/InvenTree/templates/InvenTree/settings/so.html b/InvenTree/templates/InvenTree/settings/so.html index 2fe5680d71..48a88e3aad 100644 --- a/InvenTree/templates/InvenTree/settings/so.html +++ b/InvenTree/templates/InvenTree/settings/so.html @@ -12,6 +12,9 @@ {% include "InvenTree/settings/header.html" %} + {% include "InvenTree/settings/setting.html" with key="SO_FUNCTION_ENABLE" icon="fa-check" %} + {% include "InvenTree/settings/setting.html" with key="SELL_FUNCTION_ENABLE" icon="fa-check" %} + {% include "InvenTree/settings/setting.html" with key="SALESORDER_REFERENCE_PREFIX" %}
diff --git a/InvenTree/templates/InvenTree/settings/stock.html b/InvenTree/templates/InvenTree/settings/stock.html index e05def09a6..bdd417b56e 100644 --- a/InvenTree/templates/InvenTree/settings/stock.html +++ b/InvenTree/templates/InvenTree/settings/stock.html @@ -12,6 +12,8 @@ {% include "InvenTree/settings/header.html" %} + {% include "InvenTree/settings/setting.html" with key="STOCK_FUNCTION_ENABLE" icon="fa-check" %} + {% include "InvenTree/settings/setting.html" with key="STOCK_GROUP_BY_PART" icon="fa-layer-group" %} {% include "InvenTree/settings/setting.html" with key="STOCK_ENABLE_EXPIRY" icon="fa-stopwatch" %} {% include "InvenTree/settings/setting.html" with key="STOCK_STALE_DAYS" icon="fa-calendar" %} diff --git a/InvenTree/templates/navbar.html b/InvenTree/templates/navbar.html index 42124266d6..39719edba0 100644 --- a/InvenTree/templates/navbar.html +++ b/InvenTree/templates/navbar.html @@ -3,6 +3,12 @@ {% load i18n %} {% settings_value 'BARCODE_ENABLE' as barcodes %} +{% settings_value 'BUILD_FUNCTION_ENABLE' as enable_build %} +{% settings_value 'BUY_FUNCTION_ENABLE' as enable_buy %} +{% settings_value 'SELL_FUNCTION_ENABLE' as enable_sell %} +{% settings_value 'STOCK_FUNCTION_ENABLE' as enable_stock %} +{% settings_value 'SO_FUNCTION_ENABLE' as enable_so %} +{% settings_value 'PO_FUNCTION_ENABLE' as enable_po %}