fix: WMaterialCreateSerializer 所有字段设为必填

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
caoqianming 2026-03-27 10:10:18 +08:00
parent 320822019a
commit 68191dc305
1 changed files with 6 additions and 0 deletions

View File

@ -211,6 +211,12 @@ class WMaterialCreateSerializer(CustomModelSerializer):
class Meta:
model = WMaterial
fields = ['material', 'count', 'batch', 'mgroup']
extra_kwargs = {
'material': {'required': True},
'count': {'required': True},
'batch': {'required': True},
'mgroup': {'required': True, 'allow_null': False},
}
def validate(self, attrs):
attrs['belong_dept'] = attrs['mgroup'].belong_dept