mirror of
https://github.com/inventree/inventree-docs.git
synced 2025-06-22 15:00:39 +00:00
@ -11,7 +11,7 @@ When a certain (server-side) event occurs, the background worker passes the even
|
||||
Implementing classes must provide a `process_event` function:
|
||||
|
||||
```python
|
||||
class EventPlugin(EventMixin, IntegrationPluginBase):
|
||||
class EventPlugin(EventMixin, InvenTreePlugin):
|
||||
"""
|
||||
A simple example plugin which responds to events on the InvenTree server.
|
||||
|
||||
@ -19,9 +19,9 @@ class EventPlugin(EventMixin, IntegrationPluginBase):
|
||||
A more complex plugin could respond to specific events however it wanted.
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = "EventPlugin"
|
||||
PLUGIN_SLUG = "event"
|
||||
PLUGIN_TITLE = "Triggered Events"
|
||||
NAME = "EventPlugin"
|
||||
SLUG = "event"
|
||||
TITLE = "Triggered Events"
|
||||
|
||||
def process_event(self, event, *args, **kwargs):
|
||||
print(f"Processing triggered event: '{event}'")
|
||||
|
@ -27,16 +27,16 @@ Plugins which implement the `LabelPrintingMixin` mixin class must provide a `pri
|
||||
```python
|
||||
from dummy_printer import printer_backend
|
||||
|
||||
class MyLabelPrinter(LabelPrintingMixin, IntegrationPluginBase):
|
||||
class MyLabelPrinter(LabelPrintingMixin, InvenTreePlugin):
|
||||
"""
|
||||
A simple example plugin which provides support for a dummy printer.
|
||||
|
||||
A more complex plugin would communicate with an actual printer!
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = "MyLabelPrinter"
|
||||
PLUGIN_SLUG = "mylabel"
|
||||
PLUGIN_TITLE = "A dummy printer"
|
||||
NAME = "MyLabelPrinter"
|
||||
SLUG = "mylabel"
|
||||
TITLE = "A dummy printer"
|
||||
|
||||
def print_label(self, label, **kwargs):
|
||||
"""
|
||||
|
@ -8,9 +8,9 @@ Use the class constant `NAVIGATION` for a array of links that should be added to
|
||||
The array must contain at least one dict that at least define a name and a link for each element. The link must be formatted for a URL pattern name lookup - links to external sites are not possible directly. The optional icon must be a class reference to an icon (InvenTree ships with fontawesome 4 by default).
|
||||
|
||||
``` python
|
||||
class MyNavigationPlugin(NavigationMixin, IntegrationPluginBase):
|
||||
class MyNavigationPlugin(NavigationMixin, InvenTreePlugin):
|
||||
|
||||
PLUGIN_NAME = "NavigationPlugin"
|
||||
NAME = "NavigationPlugin"
|
||||
|
||||
NAVIGATION = [
|
||||
{'name': 'SampleIntegration', 'link': 'plugin:sample:hi', 'icon': 'fas fa-box'},
|
||||
|
@ -16,13 +16,13 @@ The ScheduleMixin class provides a plugin with the ability to call functions at
|
||||
An example of a plugin which supports scheduled tasks:
|
||||
|
||||
```python
|
||||
class ScheduledTaskPlugin(ScheduleMixin, SettingsMixin, IntegrationPluginBase):
|
||||
class ScheduledTaskPlugin(ScheduleMixin, SettingsMixin, InvenTreePlugin):
|
||||
"""
|
||||
Sample plugin which runs a scheduled task, and provides user configuration.
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = "Scheduled Tasks"
|
||||
PLUGIN_SLUG = 'schedule'
|
||||
NAME = "Scheduled Tasks"
|
||||
SLUG = 'schedule'
|
||||
|
||||
SCHEDULED_TASKS = {
|
||||
'global': {
|
||||
|
@ -15,9 +15,9 @@ The dict must be formatted similar to the following sample. Take a look at the s
|
||||
|
||||
|
||||
``` python
|
||||
class PluginWithSettings(SettingsMixin, IntegrationPluginBase):
|
||||
class PluginWithSettings(SettingsMixin, InvenTreePlugin):
|
||||
|
||||
PLUGIN_NAME = "PluginWithSettings"
|
||||
NAME = "PluginWithSettings"
|
||||
|
||||
SETTINGS = {
|
||||
'API_ENABLE': {
|
||||
|
@ -9,9 +9,9 @@ Use the class constant `URLS` for a array of URLs that should be added to InvenT
|
||||
The array has to contain valid URL patterns as defined in the [django documentation](https://docs.djangoproject.com/en/stable/topics/http/urls/).
|
||||
|
||||
``` python
|
||||
class MyUrlsPlugin(URLsMixin, IntegrationPluginBase):
|
||||
class MyUrlsPlugin(URLsMixin, InvenTreePlugin):
|
||||
|
||||
PLUGIN_NAME = "UrlsMixin"
|
||||
NAME = "UrlsMixin"
|
||||
|
||||
URLS = [
|
||||
url(r'increase/(?P<location>\d+)/(?P<pk>\d+)/', self.view_increase, name='increase-level'),
|
||||
|
Reference in New Issue
Block a user