2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-07-04 14:10:52 +00:00
Files
InvenTree/docs/docs/plugins/mixins/transition.md
T
Oliver a79ab40f5e 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>
2025-08-01 09:35:03 +10:00

889 B

title
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") }}).