修改计划排程列表进入待排程的制造订单详情进行排程-报错
This commit is contained in:
@@ -191,7 +191,7 @@ class sf_production_plan(models.Model):
|
|||||||
|
|
||||||
return num
|
return num
|
||||||
|
|
||||||
def do_production_schedule(self, date_planned_start):
|
def do_production_schedule(self):
|
||||||
"""
|
"""
|
||||||
排程方法
|
排程方法
|
||||||
"""
|
"""
|
||||||
@@ -199,8 +199,7 @@ class sf_production_plan(models.Model):
|
|||||||
if not record.production_line_id:
|
if not record.production_line_id:
|
||||||
raise ValidationError("未选择生产线")
|
raise ValidationError("未选择生产线")
|
||||||
else:
|
else:
|
||||||
|
is_schedule = self.deal_processing_schedule(record.date_planned_start)
|
||||||
is_schedule = self.deal_processing_schedule(date_planned_start)
|
|
||||||
if not is_schedule:
|
if not is_schedule:
|
||||||
raise ValidationError("排程失败")
|
raise ValidationError("排程失败")
|
||||||
workorder_id_list = record.production_id.workorder_ids.ids
|
workorder_id_list = record.production_id.workorder_ids.ids
|
||||||
@@ -209,7 +208,6 @@ class sf_production_plan(models.Model):
|
|||||||
for item in record.production_id.workorder_ids:
|
for item in record.production_id.workorder_ids:
|
||||||
if item.name == 'CNC加工':
|
if item.name == 'CNC加工':
|
||||||
item.date_planned_finished = datetime.now() + timedelta(days=100)
|
item.date_planned_finished = datetime.now() + timedelta(days=100)
|
||||||
# item.date_planned_start = record.date_planned_start
|
|
||||||
item.date_planned_start = self.date_planned_start if self.date_planned_start else datetime.now()
|
item.date_planned_start = self.date_planned_start if self.date_planned_start else datetime.now()
|
||||||
record.sudo().production_id.plan_start_processing_time = item.date_planned_start
|
record.sudo().production_id.plan_start_processing_time = item.date_planned_start
|
||||||
item.date_planned_finished = item.date_planned_start + timedelta(
|
item.date_planned_finished = item.date_planned_start + timedelta(
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class Action_Plan_All_Wizard(models.TransientModel):
|
|||||||
plan_obj = self.env['sf.production.plan'].browse(plan.id)
|
plan_obj = self.env['sf.production.plan'].browse(plan.id)
|
||||||
plan_obj.production_line_id = self.production_line_id.id
|
plan_obj.production_line_id = self.production_line_id.id
|
||||||
plan.date_planned_start = self.date_planned_start
|
plan.date_planned_start = self.date_planned_start
|
||||||
plan_obj.do_production_schedule(self.date_planned_start)
|
plan_obj.do_production_schedule()
|
||||||
# plan_obj.state = 'done'
|
# plan_obj.state = 'done'
|
||||||
print('处理计划:', plan.id, '完成')
|
print('处理计划:', plan.id, '完成')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user