feat: 添加wmaterial检索字段

This commit is contained in:
caoqianming 2025-03-06 09:02:07 +08:00
parent 33957216cd
commit afdcc5374e
1 changed files with 2 additions and 2 deletions

View File

@ -136,7 +136,7 @@ class WMaterialViewSet(ListModelMixin, CustomGenericViewSet):
serializer_class = WMaterialSerializer serializer_class = WMaterialSerializer
select_related_fields = ['material', 'belong_dept', 'material__process', 'supplier'] select_related_fields = ['material', 'belong_dept', 'material__process', 'supplier']
search_fields = ['material__name', search_fields = ['material__name',
'material__number', 'material__specification', 'batch', 'material__model'] 'material__number', 'material__specification', 'batch', 'material__model', "defect__name", "notok_sign"]
filterset_class = WMaterialFilter filterset_class = WMaterialFilter
ordering_fields = ["update_time", "state", "count", "count_xtest"] ordering_fields = ["update_time", "state", "count", "count_xtest"]
@ -398,7 +398,7 @@ class HandoverViewSet(CustomModelViewSet):
ins: Handover = self.get_object() ins: Handover = self.get_object()
user: User = self.request.user user: User = self.request.user
if ins.type != Handover.H_SCRAP: if ins.type != Handover.H_SCRAP:
if user == ins.recive_user or user.belong_dept == ins.recive_user.belong_dept: if ins.recive_user is None or user == ins.recive_user or user.belong_dept == ins.recive_user.belong_dept:
pass pass
else: else:
raise ParseError('非接收人不可提交') raise ParseError('非接收人不可提交')