mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +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") }}). | ||||
		Reference in New Issue
	
	Block a user