diff --git a/InvenTree/InvenTree/events.py b/InvenTree/InvenTree/events.py index 75b04adb00..2286f57d7b 100644 --- a/InvenTree/InvenTree/events.py +++ b/InvenTree/InvenTree/events.py @@ -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 diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index dee0eb2e8b..d361cb5bb1 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -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: diff --git a/InvenTree/templates/InvenTree/settings/plugin.html b/InvenTree/templates/InvenTree/settings/plugin.html index 858d0f3ab9..7b428e161f 100644 --- a/InvenTree/templates/InvenTree/settings/plugin.html +++ b/InvenTree/templates/InvenTree/settings/plugin.html @@ -20,6 +20,7 @@