feat: 增加materials 筛选

This commit is contained in:
caoqianming 2024-01-24 11:48:33 +08:00
parent 20e209ced2
commit 4a0f73c783
3 changed files with 23 additions and 2 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 3.2.12 on 2024-01-24 03:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mtm', '0025_auto_20231120_1139'),
('inm', '0012_auto_20231218_1552'),
]
operations = [
migrations.AddField(
model_name='mio',
name='materials',
field=models.ManyToManyField(blank=True, through='inm.MIOItem', to='mtm.Material', verbose_name='物料明细'),
),
]

View File

@ -92,6 +92,8 @@ class MIO(CommonBDModel):
User, verbose_name='仓库执行人', related_name='mio_user_mio', on_delete=models.CASCADE, null=True, blank=True)
do_user = models.ForeignKey(
User, verbose_name='车间执行人', related_name='do_user_mio', on_delete=models.CASCADE, null=True, blank=True)
materials = models.ManyToManyField(
Material, verbose_name='物料明细', through='inm.mioitem', blank=True)
class MIOItem(BaseModel):

View File

@ -129,8 +129,8 @@ class MIOViewSet(CustomModelViewSet):
"type": ["exact", "in"],
"pu_order": ["exact"],
"order": ["exact"],
"item_mio__material": ["exact"],
"item_mio__material__type": ["exact", "in"]
"materials": ["exact"],
"materials__type": ["exact", "in"]
}
search_fields = ['number']
data_filter = True