工艺确认重置表面工艺工单的关联采购单代码还原
This commit is contained in:
@@ -396,23 +396,6 @@ class RePurchaseOrder(models.Model):
|
|||||||
production = self.env['mrp.production'].search([('name', '=', production_name)])
|
production = self.env['mrp.production'].search([('name', '=', production_name)])
|
||||||
for workorder in production.workorder_ids.filtered(
|
for workorder in production.workorder_ids.filtered(
|
||||||
lambda wd: wd.routing_type == '表面工艺' and wd.state == 'waiting' and line.product_id.server_product_process_parameters_id == wd.surface_technics_parameters_id):
|
lambda wd: wd.routing_type == '表面工艺' and wd.state == 'waiting' and line.product_id.server_product_process_parameters_id == wd.surface_technics_parameters_id):
|
||||||
work_ids = workorder.production_id.workorder_ids.filtered(
|
|
||||||
lambda wk: wk.state not in ['done', 'rework', 'cancel'])
|
|
||||||
min_sequence_wk = min(work_ids, key=lambda wk: wk.sequence)
|
|
||||||
artificial_offline = (
|
|
||||||
workorder.production_id.production_type == '人工线下加工' and workorder.production_id.schedule_state != '已排')
|
|
||||||
auto_production = (
|
|
||||||
workorder.production_id.production_type == '自动化产线加工' and workorder.production_id.programming_state != '已编程')
|
|
||||||
if workorder.sequence == min_sequence_wk.sequence:
|
|
||||||
if artificial_offline or auto_production:
|
|
||||||
raise UserError('等待组件')
|
|
||||||
else:
|
|
||||||
sorted_work_ids = work_ids.sorted(key=lambda w: w.sequence)
|
|
||||||
previous_workorder = self.env['mrp.workorder'].search([('sequence', '<', workorder.sequence),
|
|
||||||
('production_id', '=', workorder.production_id.id),
|
|
||||||
('state', '=', 'done')], order='sequence desc', limit=1)
|
|
||||||
if not previous_workorder:
|
|
||||||
raise UserError('等待组件')
|
|
||||||
workorder.state = 'ready'
|
workorder.state = 'ready'
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user