mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Adds 'length' and 'width' fields to label models
This commit is contained in:
parent
ad6c69ecc7
commit
a742df2c12
34
InvenTree/label/migrations/0006_auto_20210222_0952.py
Normal file
34
InvenTree/label/migrations/0006_auto_20210222_0952.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Generated by Django 3.0.7 on 2021-02-21 22:52
|
||||||
|
|
||||||
|
import django.core.validators
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('label', '0005_auto_20210113_2302'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='stockitemlabel',
|
||||||
|
name='length',
|
||||||
|
field=models.FloatField(default=20, help_text='Label length, specified in mm', validators=[django.core.validators.MinValueValidator(2)], verbose_name='Length [mm]'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='stockitemlabel',
|
||||||
|
name='width',
|
||||||
|
field=models.FloatField(default=10, help_text='Label width, specified in mm', validators=[django.core.validators.MinValueValidator(2)], verbose_name='Width [mm]'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='stocklocationlabel',
|
||||||
|
name='length',
|
||||||
|
field=models.FloatField(default=20, help_text='Label length, specified in mm', validators=[django.core.validators.MinValueValidator(2)], verbose_name='Length [mm]'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='stocklocationlabel',
|
||||||
|
name='width',
|
||||||
|
field=models.FloatField(default=10, help_text='Label width, specified in mm', validators=[django.core.validators.MinValueValidator(2)], verbose_name='Width [mm]'),
|
||||||
|
),
|
||||||
|
]
|
@ -11,7 +11,7 @@ import io
|
|||||||
from blabel import LabelWriter
|
from blabel import LabelWriter
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.core.validators import FileExtensionValidator
|
from django.core.validators import FileExtensionValidator, MinValueValidator
|
||||||
from django.core.exceptions import ValidationError, FieldError
|
from django.core.exceptions import ValidationError, FieldError
|
||||||
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@ -92,6 +92,20 @@ class LabelTemplate(models.Model):
|
|||||||
help_text=_('Label template is enabled'),
|
help_text=_('Label template is enabled'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
length = models.FloatField(
|
||||||
|
default=20,
|
||||||
|
verbose_name=_('Length [mm]'),
|
||||||
|
help_text=_('Label length, specified in mm'),
|
||||||
|
validators=[MinValueValidator(2)]
|
||||||
|
)
|
||||||
|
|
||||||
|
width = models.FloatField(
|
||||||
|
default=10,
|
||||||
|
verbose_name=('Width [mm]'),
|
||||||
|
help_text=_('Label width, specified in mm'),
|
||||||
|
validators=[MinValueValidator(2)]
|
||||||
|
)
|
||||||
|
|
||||||
def get_record_data(self, items):
|
def get_record_data(self, items):
|
||||||
"""
|
"""
|
||||||
Return a list of dict objects, one for each item.
|
Return a list of dict objects, one for each item.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user