feat: mioitemw 返回wpr_number_out
This commit is contained in:
parent
b9376cc2d6
commit
e30241dc22
|
@ -5,13 +5,15 @@ from django.db import transaction
|
||||||
from rest_framework.exceptions import ParseError
|
from rest_framework.exceptions import ParseError
|
||||||
from apps.wpmw.models import Wpr
|
from apps.wpmw.models import Wpr
|
||||||
from apps.mtm.models import Material
|
from apps.mtm.models import Material
|
||||||
|
from rest_framework import serializers
|
||||||
|
|
||||||
class MIOItemwCreateUpdateSerializer(CustomModelSerializer):
|
class MIOItemwCreateUpdateSerializer(CustomModelSerializer):
|
||||||
ftest = FtestProcessSerializer(required=False)
|
ftest = FtestProcessSerializer(required=False)
|
||||||
|
wpr_number_out = serializers.CharField(source="wpr.number_out", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = MIOItemw
|
model = MIOItemw
|
||||||
fields = ["id", "number", "wpr", "note", "mioitem", "ftest"]
|
fields = ["id", "number", "wpr", "note", "mioitem", "ftest", "wpr_number_out"]
|
||||||
|
|
||||||
def validate(self, attrs):
|
def validate(self, attrs):
|
||||||
mioitem: MIOItem = attrs["mioitem"]
|
mioitem: MIOItem = attrs["mioitem"]
|
||||||
|
|
|
@ -462,7 +462,7 @@ class MIOItemwViewSet(CustomModelViewSet):
|
||||||
perms_map = {'get': '*', 'post': 'mio.update', 'put': 'mio.update', 'delete': 'mio.update'}
|
perms_map = {'get': '*', 'post': 'mio.update', 'put': 'mio.update', 'delete': 'mio.update'}
|
||||||
queryset = MIOItemw.objects.all()
|
queryset = MIOItemw.objects.all()
|
||||||
serializer_class = MIOItemwCreateUpdateSerializer
|
serializer_class = MIOItemwCreateUpdateSerializer
|
||||||
filterset_fields = ['mioitem']
|
filterset_fields = ['mioitem', 'wpr']
|
||||||
ordering = ["number", "create_time"]
|
ordering = ["number", "create_time"]
|
||||||
ordering_fields = ["number", "create_time"]
|
ordering_fields = ["number", "create_time"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue