Skip to content

Commit

Permalink
Update old migrations - add field validator
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat committed Dec 28, 2024
1 parent a731afc commit 08a1571
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.db import migrations

import generic.states.fields
import generic.states.validators
import InvenTree.status_codes


Expand All @@ -23,6 +24,11 @@ class Migration(migrations.Migration):
help_text="Additional status information for this item",
null=True,
verbose_name="Custom status key",
validators=[
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.BuildStatus
),
]
),
),
migrations.AlterField(
Expand All @@ -32,7 +38,12 @@ class Migration(migrations.Migration):
choices=InvenTree.status_codes.BuildStatus.items(),
default=10,
help_text="Build status code",
validators=[django.core.validators.MinValueValidator(0)],
validators=[
django.core.validators.MinValueValidator(0),
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.BuildStatus
),
],
verbose_name="Build Status",
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.db import migrations

import generic.states.fields
import generic.states.validators
import InvenTree.status_codes


Expand All @@ -22,6 +23,11 @@ class Migration(migrations.Migration):
help_text="Additional status information for this item",
null=True,
verbose_name="Custom status key",
validators=[
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.PurchaseOrderStatus
),
]
),
),
migrations.AddField(
Expand All @@ -33,6 +39,11 @@ class Migration(migrations.Migration):
help_text="Additional status information for this item",
null=True,
verbose_name="Custom status key",
validators=[
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.ReturnOrderStatus
),
]
),
),
migrations.AddField(
Expand All @@ -44,6 +55,11 @@ class Migration(migrations.Migration):
help_text="Additional status information for this item",
null=True,
verbose_name="Custom status key",
validators=[
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.ReturnOrderLineStatus
),
]
),
),
migrations.AddField(
Expand All @@ -55,6 +71,11 @@ class Migration(migrations.Migration):
help_text="Additional status information for this item",
null=True,
verbose_name="Custom status key",
validators=[
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.SalesOrderStatus
),
]
),
),
migrations.AlterField(
Expand All @@ -65,6 +86,11 @@ class Migration(migrations.Migration):
default=10,
help_text="Purchase order status",
verbose_name="Status",
validators=[
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.PurchaseOrderStatus
),
]
),
),
migrations.AlterField(
Expand All @@ -75,6 +101,11 @@ class Migration(migrations.Migration):
default=10,
help_text="Return order status",
verbose_name="Status",
validators=[
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.ReturnOrderStatus
),
]
),
),
migrations.AlterField(
Expand All @@ -85,6 +116,11 @@ class Migration(migrations.Migration):
default=10,
help_text="Outcome for this line item",
verbose_name="Outcome",
validators=[
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.ReturnOrderLineStatus
),
]
),
),
migrations.AlterField(
Expand All @@ -95,6 +131,11 @@ class Migration(migrations.Migration):
default=10,
help_text="Sales order status",
verbose_name="Status",
validators=[
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.SalesOrderStatus
),
]
),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import generic.states
import generic.states.fields
import generic.states.validators
import InvenTree.status_codes


Expand All @@ -24,6 +25,11 @@ class Migration(migrations.Migration):
help_text="Additional status information for this item",
null=True,
verbose_name="Custom status key",
validators=[
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.StockStatus
),
],
),
),
migrations.AlterField(
Expand All @@ -32,7 +38,12 @@ class Migration(migrations.Migration):
field=generic.states.fields.InvenTreeCustomStatusModelField(
choices=InvenTree.status_codes.StockStatus.items(),
default=10,
validators=[django.core.validators.MinValueValidator(0)],
validators=[
django.core.validators.MinValueValidator(0),
generic.states.validators.CustomStatusCodeValidator(
status_class=InvenTree.status_codes.StockStatus
),
],
),
),
]

0 comments on commit 08a1571

Please sign in to comment.