diff --git a/InvenTree/plugin/base/action/api.py b/InvenTree/plugin/base/action/api.py index 998e410dce..944d921487 100644 --- a/InvenTree/plugin/base/action/api.py +++ b/InvenTree/plugin/base/action/api.py @@ -31,11 +31,7 @@ class ActionPluginView(APIView): action_plugins = registry.with_mixin('action') for plugin in action_plugins: if plugin.action_name() == action: - # TODO @matmair use easier syntax once InvenTree 0.7.0 is released - plugin.init(request.user, data=data) - - plugin.perform_action() - + plugin.perform_action(request.user, data=data) return Response(plugin.get_response()) # If we got to here, no matching action was found diff --git a/InvenTree/plugin/base/action/mixins.py b/InvenTree/plugin/base/action/mixins.py index 70fea86a7e..0896055e19 100644 --- a/InvenTree/plugin/base/action/mixins.py +++ b/InvenTree/plugin/base/action/mixins.py @@ -15,10 +15,9 @@ class ActionMixin: """ MIXIN_NAME = 'Actions' - def __init__(self, user=None, data=None): + def __init__(self): super().__init__() self.add_mixin('action', True, __class__) - self.init(user, data) def action_name(self): """ @@ -31,14 +30,7 @@ class ActionMixin: return self.ACTION_NAME return self.name - def init(self, user, data=None): - """ - An action plugin takes a user reference, and an optional dataset (dict) - """ - self.user = user - self.data = data - - def perform_action(self): + def perform_action(self, user=None, data=None): """ Override this method to perform the action! """