feat(backend): switch to a more formal FSM approach (#12507)

* full fsm implementation

closes https://github.com/inventree/InvenTree/issues/12314

based on https://github.com/matmair/InvenTree/pull/721

* update assertations

* refactor to reduce duplication

* move for cleaner diff

* more moving stuff around

* fix assingment

* remove skip

* merge test classes

* re-enable transition plugin tests

* fix docstrings

* add depreciation warning

* fix type

* nitpicks

* small cleanup

* ensure we alwas pass a str

* add backport

* fix marker position

* full fsm implementation

closes https://github.com/inventree/InvenTree/issues/12314

based on https://github.com/matmair/InvenTree/pull/721

* update assertations

* refactor to reduce duplication

* move for cleaner diff

* more moving stuff around

* fix assingment

* remove skip

* merge test classes

* re-enable transition plugin tests

* fix docstrings

* add depreciation warning

* fix type

* nitpicks

* small cleanup

* ensure we alwas pass a str

* add backport

* fix marker position

* fix ty issue

* ignore this corner case

* ensure invalid transitions can raise a nice validation error

* compact code

* add depreciation mark

* make raise_error default (#754)

* fix merge

* adjust test as this is now not a no-op but a raised error

* fix assertations

* fix test to not take a broken path

* remove unused test statements

* converge

* add test branch for actually working transition

* reduce uneeded code

* ignore depreceated methods

* fix missing coverage

* add prefetch

* reduce diff
This commit is contained in:
Matthias Mair
2026-08-12 07:45:43 +10:00
committed by GitHub
parent 7cb3d78a5f
commit 40c528164f
19 changed files with 923 additions and 747 deletions
+16
View File
@@ -510,6 +510,7 @@ django==5.2.16 \
# django-error-report-2
# django-filter
# django-flags
# django-fsm-2
# django-ical
# django-js-asset
# django-maintenance-mode
@@ -527,6 +528,7 @@ django==5.2.16 \
# django-stdimage
# django-storages
# django-structlog
# django-stubs-ext
# django-taggit
# django-xforwardedfor-middleware
# djangorestframework
@@ -580,6 +582,12 @@ django-flags==5.2.0 \
# via
# -c src/backend/requirements.txt
# -r src/backend/requirements.in
django-fsm-2==4.2.4 \
--hash=sha256:0072be359520075eee4baead3873e5eb8f1700b4f91e41208058cbea0ceae9b9 \
--hash=sha256:0e395afd03ff504afd476e8568ca213aafc3324bd4e5427e5b3287f7b1e7d979
# via
# -c src/backend/requirements.txt
# -r src/backend/requirements.in
django-ical==1.9.2 \
--hash=sha256:44c9b6fa90d09f25e9ebaa91ed9eb007f079afbc23d6aac909cfc18188a8e90c \
--hash=sha256:74a16bca05735f91a00120cad7250f3c3aa292a9f698a6cfdc544a922c11de70
@@ -703,6 +711,12 @@ django-structlog==10.1.0 \
# via
# -c src/backend/requirements.txt
# -r src/backend/requirements.in
django-stubs-ext==6.0.6 \
--hash=sha256:5470c970f61a3ccf5aae7633feef1a097f944f417b955da200c9ac26ecd9134b \
--hash=sha256:e6f09884e48d7c5b250a373dfa22aa3e83bb91b8babbd8d05187f6b92247f232
# via
# -c src/backend/requirements.txt
# django-fsm-2
django-taggit==6.1.0 \
--hash=sha256:ab776264bbc76cb3d7e49e1bf9054962457831bd21c3a42db9138b41956e4cf0 \
--hash=sha256:c4d1199e6df34125dd36db5eb0efe545b254dec3980ce5dd80e6bab3e78757c3
@@ -2127,6 +2141,8 @@ typing-extensions==4.16.0 \
--hash=sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5
# via
# -c src/backend/requirements.txt
# -r src/backend/requirements.in
# django-stubs-ext
# flexcache
# flexparser
# grpcio