feat: mlog 支持handle_user 默认create_by

This commit is contained in:
caoqianming 2024-12-04 12:22:52 +08:00
parent 5533cc6967
commit a69f718859
1 changed files with 3 additions and 0 deletions

View File

@ -469,6 +469,9 @@ class MlogSerializer(CustomModelSerializer):
material_out = attrs['material_out']
if not (mgroup and material_out):
raise ValidationError('缺少工段或产物!')
handle_user = attrs.get('handle_user', None)
if handle_user is None and hasattr(self, "request"):
handle_user = self.request.user
return attrs