mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-07 12:22:11 +00:00
Transition plugin (#10088)
* Add new enum * Define StateTransitionMixin class * Import * Rename plugin mixin class - Avoid naming clash * Offload transitions to plugin registry * fix imports * Fix default value * Fix sample transition class * Refactor unit test * Add docs * Fix type hinting * Check for expected message * Tests for various failure modes * Tweak query count limit * Exclude lines from coverage * Remove debug code --------- Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
16
docs/docs/plugins/mixins/transition.md
Normal file
16
docs/docs/plugins/mixins/transition.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: Transition Mixin
|
||||
---
|
||||
|
||||
## TransitionMixin
|
||||
|
||||
The `TransitionMixin` allows plugins to provide custom state transition logic for InvenTree models.
|
||||
|
||||
Model types which support transition between different "states" (e.g. orders), can be extended to support custom transition logic by implementing the `TransitionMixin` class.
|
||||
|
||||
This allows for custom functionality to be executed when a state transition occurs, such as sending notifications, updating related models, or performing other actions.
|
||||
|
||||
Additionally, the mixin can be used to prevent certain transitions from occurring, or to modify the transition logic based on custom conditions.
|
||||
|
||||
!!! info "More Info"
|
||||
For more information on this plugin mixin, refer to the InvenTree source code. [A working example is available as a starting point]({{ sourcefile("/src/backend/InvenTree/plugin/samples/integration/transition.py") }}).
|
@@ -233,6 +233,7 @@ nav:
|
||||
- Report Mixin: plugins/mixins/report.md
|
||||
- Schedule Mixin: plugins/mixins/schedule.md
|
||||
- Settings Mixin: plugins/mixins/settings.md
|
||||
- Transition Mixin: plugins/mixins/transition.md
|
||||
- URL Mixin: plugins/mixins/urls.md
|
||||
- User Interface Mixin: plugins/mixins/ui.md
|
||||
- Validation Mixin: plugins/mixins/validation.md
|
||||
|
Reference in New Issue
Block a user