feat: inm mio相关增加inout_date校验

This commit is contained in:
caoqianming 2024-09-08 14:32:49 +08:00
parent c07d0666c0
commit bb270d7105
1 changed files with 4 additions and 0 deletions

View File

@ -168,6 +168,7 @@ class MIODoSerializer(CustomModelSerializer):
model = MIO
fields = ['id', 'number', 'note', 'do_user',
'belong_dept', 'type', 'inout_date', 'mgroup']
extra_kwargs = {'inout_date': {'required': True}, 'do_user': {'required': True}}
def validate(self, attrs):
if 'mgroup' in attrs and attrs['mgroup']:
@ -193,6 +194,7 @@ class MIOSaleSerializer(CustomModelSerializer):
class Meta:
model = MIO
fields = ['id', 'number', 'note', 'order', 'inout_date', 'customer']
extra_kwargs = {'inout_date': {'required': True}}
def create(self, validated_data):
validated_data['type'] = MIO.MIO_TYPE_SALE_OUT
@ -219,6 +221,7 @@ class MIOPurSerializer(CustomModelSerializer):
class Meta:
model = MIO
fields = ['id', 'number', 'note', 'pu_order', 'inout_date', 'supplier']
extra_kwargs = {'inout_date': {'required': True}}
def create(self, validated_data):
validated_data['type'] = MIO.MIO_TYPE_PUR_IN
@ -244,6 +247,7 @@ class MIOOtherSerializer(CustomModelSerializer):
model = MIO
fields = ['id', 'number', 'note', 'supplier',
'customer', 'type', 'inout_date']
extra_kwargs = {'inout_date': {'required': True}}
def create(self, validated_data):
if validated_data['type'] not in [MIO.MIO_TYPE_OTHER_OUT, MIO.MIO_TYPE_OTHER_IN]: