Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugin_creator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def cleanup(plugin_dir: str, context: dict, skip_install: bool = False) -> None:
if not skip_install:
frontend.update_frontend(
plugin_dir,
additional_packages=context['frontend']['additional_packages'] or None
additional_packages=context['frontend']['packages'] or None
)
else:
frontend.remove_frontend(plugin_dir)
Expand Down
2 changes: 1 addition & 1 deletion plugin_creator/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def available_mixins() -> list:
# 'BarcodeMixin',
# 'BulkNotificationMethod',
# 'CurrencyExchangeMixin',
# 'EventMixin',
'EventMixin',
# 'IconPackMixin',
# 'LabelPrintingMixin',
# 'LocateMixin',
Expand Down
3 changes: 2 additions & 1 deletion plugin_creator/template/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"plugin_version": "0.1.0",
"plugin_mixins": {
"mixin_list": [
"EventMixin",
"ReportMixin",
"ScheduleMixin",
"SettingsMixin",
Expand All @@ -23,7 +24,7 @@
"ci_support": "github",
"frontend": {
"enabled": true,
"additional_packages": [],
"packages": [],
"features": {
"dashboard": true,
"panel": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ class {{ cookiecutter.plugin_name }}(InvenTreePlugin):
}
}
{%- endif %}
{% if "EventMixin" in cookiecutter.plugin_mixins.mixin_list %}
# Respond to InvenTree events (from EventMixin)
# Ref: https://docs.inventree.org/en/stable/extend/plugins/event/
def wants_process_event(self, event: str) -> bool:
"""Return True if the plugin wants to process the given event."""
# Example: only process the 'part.create' event
return event == 'part.create'

def process_event(self, event: str, *args, **kwargs) -> None:
"""Process the provided event."""
print("Processing custom event:", event)
print("Arguments:", args)
print("Keyword arguments:", kwargs)
{%- endif %}
{% if "ReportMixin" in cookiecutter.plugin_mixins.mixin_list %}
# Custom report context (from ReportMixin)
# Ref: https://docs.inventree.org/en/stable/extend/plugins/report/
Expand Down