diff --git a/InvenTree/plugin/builtin/integration/mixins.py b/InvenTree/plugin/builtin/integration/mixins.py index 7ddfeeccb8..c7edc8ac36 100644 --- a/InvenTree/plugin/builtin/integration/mixins.py +++ b/InvenTree/plugin/builtin/integration/mixins.py @@ -17,14 +17,8 @@ class SettingsMixin: def __init__(self): super().__init__() - self.add_mixin('globalsettings', 'has_globalsettings', __class__) - self.globalsettings = self.setup_globalsettings() - - def setup_globalsettings(self): - """ - Setup global settings for this plugin - """ - return getattr(self, 'SETTINGS', None) + self.add_mixin('settings', 'has_globalsettings', __class__) + self.globalsettings = getattr(self, 'SETTINGS', None) @property def has_globalsettings(self): diff --git a/InvenTree/plugin/registry.py b/InvenTree/plugin/registry.py index 4fc5330f8b..d858d6c7f0 100644 --- a/InvenTree/plugin/registry.py +++ b/InvenTree/plugin/registry.py @@ -251,7 +251,7 @@ class Plugins: if settings.PLUGIN_TESTING or InvenTreeSetting.get_setting('ENABLE_PLUGINS_GLOBALSETTING'): logger.info('Registering IntegrationPlugin global settings') for slug, plugin in plugins: - if plugin.mixin_enabled('globalsettings'): + if plugin.mixin_enabled('settings'): plugin_setting = plugin.globalsettingspatterns self.mixins_globalsettings[slug] = plugin_setting diff --git a/InvenTree/plugin/test_integration.py b/InvenTree/plugin/test_integration.py index fa585d0a40..c83be385a6 100644 --- a/InvenTree/plugin/test_integration.py +++ b/InvenTree/plugin/test_integration.py @@ -8,7 +8,7 @@ from django.contrib.auth import get_user_model from datetime import datetime from plugin import IntegrationPluginBase -from plugin.mixins import AppMixin, GlobalSettingsMixin, UrlsMixin, NavigationMixin +from plugin.mixins import AppMixin, SettingsMixin, UrlsMixin, NavigationMixin from plugin.urls import PLUGIN_BASE @@ -20,19 +20,19 @@ class BaseMixinDefinition: self.assertEqual(self.mixin.registered_mixins[0]['human_name'], self.MIXIN_HUMAN_NAME) -class GlobalSettingsMixinTest(BaseMixinDefinition, TestCase): +class SettingsMixinTest(BaseMixinDefinition, TestCase): MIXIN_HUMAN_NAME = 'Settings' - MIXIN_NAME = 'globalsettings' + MIXIN_NAME = 'settings' MIXIN_ENABLE_CHECK = 'has_globalsettings' TEST_SETTINGS = {'SETTING1': {'default': '123', }} def setUp(self): - class SettingsCls(GlobalSettingsMixin, IntegrationPluginBase): + class SettingsCls(SettingsMixin, IntegrationPluginBase): GLOBALSETTINGS = self.TEST_SETTINGS self.mixin = SettingsCls() - class NoSettingsCls(GlobalSettingsMixin, IntegrationPluginBase): + class NoSettingsCls(SettingsMixin, IntegrationPluginBase): pass self.mixin_nothing = NoSettingsCls()