feat: MlogInitSerializer 可传入handle_date
This commit is contained in:
parent
2bb1cf2844
commit
a8ed1c3083
|
@ -641,7 +641,7 @@ class MlogInitSerializer(CustomModelSerializer):
|
||||||
model = Mlog
|
model = Mlog
|
||||||
fields = ['id',
|
fields = ['id',
|
||||||
'work_start_time', 'work_end_time', 'mgroup', 'reminder_interval_list',
|
'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"]
|
read_only_fields = ["mtype"]
|
||||||
extra_kwargs = {
|
extra_kwargs = {
|
||||||
'work_start_time': {'required': True},
|
'work_start_time': {'required': True},
|
||||||
|
@ -674,7 +674,7 @@ class MlogInitSerializer(CustomModelSerializer):
|
||||||
supplier = attrs.get('supplier', None)
|
supplier = attrs.get('supplier', None)
|
||||||
if not supplier:
|
if not supplier:
|
||||||
raise ParseError('外协必须选择外协单位')
|
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'])
|
attrs['handle_date'] = localdate(attrs['work_end_time'])
|
||||||
# 如果已经确定产出,则自动获取qct
|
# 如果已经确定产出,则自动获取qct
|
||||||
if attrs.get("material_out", None):
|
if attrs.get("material_out", None):
|
||||||
|
|
Loading…
Reference in New Issue