mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 04:55:44 +00:00
Refactor: BaseInvenTreeSetting (#4834)
* Added typing for settings * Refactored common.BaseInvenTreeSetting model to make it more generic * Use older syntax for union types * Added protected option to typing * Remove now unused code * Remove old 'get_kwargs' method as it is replaced by 'get_filters_for_instance' * Trigger ci
This commit is contained in:
@ -19,6 +19,7 @@ from common.settings import currency_code_default
|
||||
from InvenTree import settings, version
|
||||
from plugin import registry
|
||||
from plugin.models import NotificationUserSetting, PluginSetting
|
||||
from plugin.plugin import InvenTreePlugin
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@ -325,6 +326,8 @@ def setting_object(key, *args, **kwargs):
|
||||
# Note, 'plugin' is an instance of an InvenTreePlugin class
|
||||
|
||||
plugin = kwargs['plugin']
|
||||
if issubclass(plugin.__class__, InvenTreePlugin):
|
||||
plugin = plugin.plugin_config()
|
||||
|
||||
return PluginSetting.get_setting_object(key, plugin=plugin, cache=cache)
|
||||
|
||||
|
Reference in New Issue
Block a user