feat: 增加规格型号字段

This commit is contained in:
caoqianming 2023-11-16 14:17:18 +08:00
parent 74ae25faf6
commit 3caf59f33d
3 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.12 on 2023-11-16 06:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mtm', '0023_auto_20231102_1128'),
]
operations = [
migrations.AddField(
model_name='material',
name='model',
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='型号'),
),
migrations.AlterField(
model_name='material',
name='specification',
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='规格'),
),
]

View File

@ -45,8 +45,10 @@ class Material(CommonAModel):
name = models.CharField('名称', max_length=50)
cate = models.CharField('大类', max_length=20, default='', blank=True)
number = models.CharField('编号', max_length=100, null=True, blank=True)
specification = models.CharField(
model = models.CharField(
'型号', max_length=100, null=True, blank=True)
specification = models.CharField(
'规格', max_length=100, null=True, blank=True)
code = models.CharField('标识', max_length=50, null=True, blank=True)
type = models.PositiveSmallIntegerField(
'物料类型', choices=type_choices, default=1, help_text=str(type_choices))
@ -70,7 +72,7 @@ class Material(CommonAModel):
ordering = ['sort', '-create_time']
def __str__(self):
return f'{self.specification}-{self.name}'
return f'{self.name}-{self.model}-{self.specification}'
class Shift(CommonAModel):

View File

@ -17,7 +17,7 @@ class ShiftSerializer(CustomModelSerializer):
class MaterialSimpleSerializer(CustomModelSerializer):
class Meta:
model = Material
fields = ['id', 'name', 'number',
fields = ['id', 'name', 'number', 'model',
'specification', 'type', 'cate', 'brothers']