mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 21:16:46 +00:00
move sample code into own file
This commit is contained in:
parent
5a2c2b96ec
commit
a91e896b20
@ -68,25 +68,3 @@ class ActionPlugin(plugin.InvenTreePlugin):
|
|||||||
"result": self.get_result(),
|
"result": self.get_result(),
|
||||||
"info": self.get_info(),
|
"info": self.get_info(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class SimpleActionPlugin(ActionPlugin):
|
|
||||||
"""
|
|
||||||
An EXTREMELY simple action plugin which demonstrates
|
|
||||||
the capability of the ActionPlugin class
|
|
||||||
"""
|
|
||||||
|
|
||||||
PLUGIN_NAME = "SimpleActionPlugin"
|
|
||||||
ACTION_NAME = "simple"
|
|
||||||
|
|
||||||
def perform_action(self):
|
|
||||||
print("Action plugin in action!")
|
|
||||||
|
|
||||||
def get_info(self):
|
|
||||||
return {
|
|
||||||
"user": self.user.username,
|
|
||||||
"hello": "world",
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_result(self):
|
|
||||||
return True
|
|
||||||
|
24
InvenTree/plugins/action/simpleactionplugin.py
Normal file
24
InvenTree/plugins/action/simpleactionplugin.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from plugins.action.action import ActionPlugin
|
||||||
|
|
||||||
|
|
||||||
|
class SimpleActionPlugin(ActionPlugin):
|
||||||
|
"""
|
||||||
|
An EXTREMELY simple action plugin which demonstrates
|
||||||
|
the capability of the ActionPlugin class
|
||||||
|
"""
|
||||||
|
|
||||||
|
PLUGIN_NAME = "SimpleActionPlugin"
|
||||||
|
ACTION_NAME = "simple"
|
||||||
|
|
||||||
|
def perform_action(self):
|
||||||
|
print("Action plugin in action!")
|
||||||
|
|
||||||
|
def get_info(self):
|
||||||
|
return {
|
||||||
|
"user": self.user.username,
|
||||||
|
"hello": "world",
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_result(self):
|
||||||
|
return True
|
Loading…
x
Reference in New Issue
Block a user