feat: MlogInitSerializer 可传入handle_date

This commit is contained in:
caoqianming 2025-08-19 10:35:45 +08:00
parent 2bb1cf2844
commit a8ed1c3083
1 changed files with 2 additions and 2 deletions

View File

@ -641,7 +641,7 @@ class MlogInitSerializer(CustomModelSerializer):
model = Mlog
fields = ['id',
'work_start_time', 'work_end_time', 'mgroup', 'reminder_interval_list',
'route', 'equipment', 'handle_user', 'note', 'supplier', 'test_file', 'test_user', 'test_time', 'oinfo_json', 'is_fix', "handle_users", "team"]
'route', 'equipment', 'handle_user', 'note', 'supplier', 'test_file', 'test_user', 'test_time', 'oinfo_json', 'is_fix', "handle_users", "team", "handle_date"]
read_only_fields = ["mtype"]
extra_kwargs = {
'work_start_time': {'required': True},
@ -674,7 +674,7 @@ class MlogInitSerializer(CustomModelSerializer):
supplier = attrs.get('supplier', None)
if not supplier:
raise ParseError('外协必须选择外协单位')
if attrs.get('work_end_time', None):
if attrs.get('work_start_time', None) and 'handle_date' not in attrs:
attrs['handle_date'] = localdate(attrs['work_end_time'])
# 如果已经确定产出则自动获取qct
if attrs.get("material_out", None):