mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 21:25:42 +00:00 
			
		
		
		
	Adds a new setting to enable event responses
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -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: | ||||
|   | ||||
| @@ -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" %} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user