Adds a new setting to enable event responses

This commit is contained in:
Oliver 2022-01-07 21:53:42 +11:00
parent 1e5ecb13f0
commit 8ff3bf1ad1
3 changed files with 17 additions and 1 deletions

View File

@ -7,6 +7,10 @@ from __future__ import unicode_literals
import logging
from django.conf import settings
from common.models import InvenTreeSetting
from InvenTree.tasks import offload_task
@ -40,3 +44,5 @@ def process_event(event, *args, **kwargs):
logger.info(f"Processing event '{event}'")
# Determine if there are any plugins which are interested in responding
if settings.PLUGIN_TESTING or InvenTreeSetting.get_setting('ENABLE_PLUGINS_EVENTS'):
pass

View File

@ -957,6 +957,8 @@ class InvenTreeSetting(BaseInvenTreeSetting):
'default': False,
'validator': bool,
},
# Settings for plugin mixin features
'ENABLE_PLUGINS_URL': {
'name': _('Enable URL integration'),
'description': _('Enable plugins to add URL routes'),
@ -984,7 +986,14 @@ class InvenTreeSetting(BaseInvenTreeSetting):
'default': False,
'validator': bool,
'requires_restart': True,
}
},
'ENABLE_PLUGINS_EVENTS': {
'name': _('Enable event integration'),
'description': _('Enable plugins to respond to internal events'),
'default': False,
'validator': bool,
'requires_restart': True,
},
}
class Meta:

View File

@ -20,6 +20,7 @@
<table class='table table-striped table-condensed'>
<tbody>
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_SCHEDULE" icon="fa-calendar-alt" %}
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_EVENTS" icon="fa-reply-all" %}
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_URL" icon="fa-link" %}
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_NAVIGATION" icon="fa-sitemap" %}
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_APP" icon="fa-rocket" %}