From 4a0f73c783da19c366586660418040a2efc9631f Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 24 Jan 2024 11:48:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0materials=20=E7=AD=9B?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/inm/migrations/0013_mio_materials.py | 19 +++++++++++++++++++ apps/inm/models.py | 2 ++ apps/inm/views.py | 4 ++-- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 apps/inm/migrations/0013_mio_materials.py diff --git a/apps/inm/migrations/0013_mio_materials.py b/apps/inm/migrations/0013_mio_materials.py new file mode 100644 index 00000000..1448521d --- /dev/null +++ b/apps/inm/migrations/0013_mio_materials.py @@ -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='物料明细'), + ), + ] diff --git a/apps/inm/models.py b/apps/inm/models.py index c4122b9e..5935ca02 100644 --- a/apps/inm/models.py +++ b/apps/inm/models.py @@ -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): diff --git a/apps/inm/views.py b/apps/inm/views.py index 1a72be3a..6050d62f 100644 --- a/apps/inm/views.py +++ b/apps/inm/views.py @@ -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