mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 03:26:45 +00:00
* Add custom user defined states * make tests more reliable * fix list options * Adapt version * do not engage if rebuilding * remove unneeded attr * remove unneeded attr * fix enum imports * adapt cove target * Add status_custom_key to all other serializers * fix serializer method * simplify branching * remove unneeded imports * inherit read_only status from leader field * Add more tests * fix tests * add test for function * refactor for easier testing * move test to seperate class * Add options testing * extend serializer * add test for all states and refactor to reuse already build functions * use custom field in PUI too * reset diff * style fix * fix comparison * Add test for str * test color exceptions too * remove user state from tracking * Add intro from model fields too * update docs * simplify implementation * update tests * fix name * rename test * simplify tags and test fully * extend test to machine status * move logic for response formatting over * extend api response with machine status * ensure only direct subclasses are discovered * test for length of total respone too * use new fields on PUI too * fix test assertion with plugins enabled * also observe rendering in filters * Add managment endpoints and APIs * Add contenttypes to PUI renderes * use filteres instead * fix import order * fix api route definition * move status choices to serializer * fix lookup * fix filtering * remove admin integration * cleanup migration * fix migration change * cleanup code location * fix imports * Add docs for custom states * add links to custom status
98 lines
3.3 KiB
Python
98 lines
3.3 KiB
Python
# Generated by Django 4.2.14 on 2024-08-07 22:40
|
|
|
|
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
|
|
from common.models import state_color_mappings
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
("contenttypes", "0002_remove_content_type_name"),
|
|
("common", "0028_colortheme_user_obj"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="InvenTreeCustomUserStateModel",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.AutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"key",
|
|
models.IntegerField(
|
|
help_text="Value that will be saved in the models database",
|
|
verbose_name="Key",
|
|
),
|
|
),
|
|
(
|
|
"name",
|
|
models.CharField(
|
|
help_text="Name of the state",
|
|
max_length=250,
|
|
verbose_name="Name",
|
|
),
|
|
),
|
|
(
|
|
"label",
|
|
models.CharField(
|
|
help_text="Label that will be displayed in the frontend",
|
|
max_length=250,
|
|
verbose_name="label",
|
|
),
|
|
),
|
|
(
|
|
"color",
|
|
models.CharField(
|
|
choices=state_color_mappings(),
|
|
default="secondary",
|
|
help_text="Color that will be displayed in the frontend",
|
|
max_length=10,
|
|
verbose_name="Color",
|
|
),
|
|
),
|
|
(
|
|
"logical_key",
|
|
models.IntegerField(
|
|
help_text="State logical key that is equal to this custom state in business logic",
|
|
verbose_name="Logical Key",
|
|
),
|
|
),
|
|
(
|
|
"reference_status",
|
|
models.CharField(
|
|
help_text="Status set that is extended with this custom state",
|
|
max_length=250,
|
|
verbose_name="Reference Status Set",
|
|
),
|
|
),
|
|
(
|
|
"model",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Model this state is associated with",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
to="contenttypes.contenttype",
|
|
verbose_name="Model",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Custom State",
|
|
"verbose_name_plural": "Custom States",
|
|
"unique_together": {
|
|
("model", "reference_status", "key", "logical_key")
|
|
},
|
|
},
|
|
),
|
|
]
|