diff --git a/InvenTree/plugin/models.py b/InvenTree/plugin/models.py index 39d863d32e..3b295c5a54 100644 --- a/InvenTree/plugin/models.py +++ b/InvenTree/plugin/models.py @@ -112,6 +112,17 @@ class GenericSettingClassMixin: self.REFERENCE_NAME: getattr(self, self.REFERENCE_NAME) } + """ + We override the following class methods, + so that we can pass the modified key instance as an additional argument + """ + + def clean(self, **kwargs): + + kwargs[self.REFERENCE_NAME] = getattr(self, self.REFERENCE_NAME) + + super().clean(**kwargs) + def is_bool(self, **kwargs): kwargs[self.REFERENCE_NAME] = getattr(self, self.REFERENCE_NAME) @@ -148,17 +159,6 @@ class PluginSetting(GenericSettingClassMixin, common.models.BaseInvenTreeSetting ('plugin', 'key'), ] - def clean(self, **kwargs): - - kwargs['plugin'] = self.plugin - - super().clean(**kwargs) - - """ - We override the following class methods, - so that we can pass the plugin instance - """ - REFERENCE_NAME = 'plugin' @classmethod @@ -208,17 +208,6 @@ class NotificationUserSetting(common.models.BaseInvenTreeSetting): ('method', 'user', 'key'), ] - def clean(self, **kwargs): - - kwargs['method'] = self.method - - super().clean(**kwargs) - - """ - We override the following class methods, - so that we can pass the method instance - """ - REFERENCE_NAME = 'method' @classmethod