diff --git a/InvenTree/part/migrations/0110_alter_part_units.py b/InvenTree/part/migrations/0110_alter_part_units.py new file mode 100644 index 0000000000..4ddad84858 --- /dev/null +++ b/InvenTree/part/migrations/0110_alter_part_units.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.19 on 2023-05-19 03:31 + +import InvenTree.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('part', '0109_auto_20230517_1048'), + ] + + operations = [ + migrations.AlterField( + model_name='part', + name='units', + field=models.CharField(blank=True, default='', help_text='Units of measure for this part', max_length=20, null=True, validators=[InvenTree.validators.validate_physical_units], verbose_name='Units'), + ), + ] diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 4e0accdfdf..5e877c9569 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -984,6 +984,9 @@ class Part(InvenTreeBarcodeMixin, InvenTreeNotesMixin, MetadataMixin, MPTTModel) blank=True, null=True, verbose_name=_('Units'), help_text=_('Units of measure for this part'), + validators=[ + validators.validate_physical_units, + ] ) assembly = models.BooleanField(