mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
setting to control plugin settings ingestion
This commit is contained in:
parent
952e7e4554
commit
c16c26c496
@ -266,6 +266,7 @@ INSTALLED_APPS = [
|
||||
'report.apps.ReportConfig',
|
||||
'stock.apps.StockConfig',
|
||||
'users.apps.UsersConfig',
|
||||
'plugin.apps.PluginConfig',
|
||||
'InvenTree.apps.InvenTreeConfig', # InvenTree app runs last
|
||||
|
||||
# Third part add-ons
|
||||
@ -764,11 +765,6 @@ for plugin in inventree_plugins.load_integration_plugins():
|
||||
|
||||
INTEGRATION_PLUGINS.append(plugin)
|
||||
INTEGRATION_PLUGIN_LIST[plugin.slug] = plugin
|
||||
if plugin.mixin_enabled('settings'):
|
||||
plugin_setting = plugin.settingspatterns
|
||||
|
||||
INTEGRATION_PLUGIN_SETTING[plugin.slug] = plugin_setting
|
||||
INTEGRATION_PLUGIN_SETTINGS.update(plugin_setting)
|
||||
|
||||
if plugin.mixin_enabled('app'):
|
||||
plugin_path = '.'.join(pathlib.Path(plugin.path).relative_to(BASE_DIR).parts)
|
||||
|
@ -866,7 +866,12 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
**settings.INTEGRATION_PLUGIN_SETTINGS,
|
||||
'ENABLE_PLUGINS_SETTING': {
|
||||
'name': _('Enable setting integration'),
|
||||
'description': _('Enable plugins to integrate into inventree settings'),
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
}
|
||||
|
||||
class Meta:
|
||||
|
19
InvenTree/plugin/apps.py
Normal file
19
InvenTree/plugin/apps.py
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.apps import AppConfig
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class PluginConfig(AppConfig):
|
||||
name = 'plugin'
|
||||
|
||||
def ready(self):
|
||||
from common.models import InvenTreeSetting
|
||||
|
||||
if InvenTreeSetting.get_setting('ENABLE_PLUGINS_SETTING'):
|
||||
for slug, plugin in settings.INTEGRATION_PLUGIN_LIST.items():
|
||||
if plugin.mixin_enabled('settings'):
|
||||
plugin_setting = plugin.settingspatterns
|
||||
settings.INTEGRATION_PLUGIN_SETTING[slug] = plugin_setting
|
||||
settings.INTEGRATION_PLUGIN_SETTINGS.update(plugin_setting)
|
@ -18,6 +18,7 @@
|
||||
<tbody>
|
||||
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_URL" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_NAVIGATION" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_SETTING"%}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user