feat: puorder增加materials字段
This commit is contained in:
parent
dc47570a5b
commit
dc8bab86cf
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.2.12 on 2023-12-01 05:36
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mtm', '0025_auto_20231120_1139'),
|
||||
('pum', '0002_alter_puorderitem_material'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='puorder',
|
||||
name='materials',
|
||||
field=models.ManyToManyField(blank=True, related_name='pu_order_materials', through='pum.PuOrderItem', to='mtm.Material', verbose_name='多个物料'),
|
||||
),
|
||||
]
|
|
@ -58,6 +58,8 @@ class PuOrder(CommonBModel):
|
|||
Supplier, verbose_name='供应商', on_delete=models.CASCADE)
|
||||
delivery_date = models.DateField('截止到货日期', null=True, blank=True)
|
||||
submit_time = models.DateTimeField('提交时间', null=True, blank=True)
|
||||
materials = models.ManyToManyField(
|
||||
Material, verbose_name='多个物料', blank=True, through='pum.puorderitem', related_name='pu_order_materials')
|
||||
|
||||
|
||||
class PuOrderItem(BaseModel):
|
||||
|
|
|
@ -4,7 +4,7 @@ from apps.utils.constants import EXCLUDE_FIELDS_DEPT, EXCLUDE_FIELDS_BASE, EXCLU
|
|||
from rest_framework.exceptions import ValidationError
|
||||
|
||||
from apps.pum.models import Supplier, PuPlan, PuPlanItem, PuOrder, PuOrderItem
|
||||
from apps.mtm.serializers import MaterialSerializer
|
||||
from apps.mtm.serializers import MaterialSerializer, MaterialSimpleSerializer
|
||||
|
||||
|
||||
class SupplierSerializer(CustomModelSerializer):
|
||||
|
@ -83,6 +83,8 @@ class PuOrderSerializer(CustomModelSerializer):
|
|||
source='create_by.name', read_only=True)
|
||||
update_by_name = serializers.CharField(
|
||||
source='update_by.name', read_only=True)
|
||||
materials_ = MaterialSimpleSerializer(
|
||||
source='materials', many=True, read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = PuOrder
|
||||
|
|
Loading…
Reference in New Issue