状态计算
This commit is contained in:
@@ -1058,18 +1058,16 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
and workorder.production_id.schedule_state == '已排'
|
and workorder.production_id.schedule_state == '已排'
|
||||||
and len(workorder.production_id.picking_ids.filtered(
|
and len(workorder.production_id.picking_ids.filtered(
|
||||||
lambda w: w.state not in ['done', 'cancel'])) == 0):
|
lambda w: w.state not in ['done', 'cancel'])) == 0):
|
||||||
workorder.state = 'ready'
|
|
||||||
if workorder.is_subcontract is True:
|
if workorder.is_subcontract is True:
|
||||||
purchase_orders_id = self._get_surface_technics_purchase_ids()
|
purchase_orders_id = self._get_surface_technics_purchase_ids()
|
||||||
if purchase_orders_id.state == 'purchase':
|
if purchase_orders_id.state == 'purchase':
|
||||||
move_out = workorder.move_subcontract_workorder_ids[1]
|
workorder.state = 'ready'
|
||||||
for mo in move_out:
|
|
||||||
if mo.state != 'done':
|
|
||||||
mo.write({'state': 'assigned', 'production_id': False})
|
|
||||||
continue
|
continue
|
||||||
continue
|
else:
|
||||||
else:
|
workorder.state = 'waiting'
|
||||||
workorder.state = 'waiting'
|
continue
|
||||||
|
else:
|
||||||
|
workorder.state = 'ready'
|
||||||
continue
|
continue
|
||||||
# ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]==========================
|
# ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]==========================
|
||||||
if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework'
|
if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework'
|
||||||
@@ -1093,17 +1091,11 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
if workorder.is_subcontract is False:
|
if workorder.is_subcontract is False:
|
||||||
workorder.state = 'ready'
|
workorder.state = 'ready'
|
||||||
else:
|
else:
|
||||||
if len(workorder.production_id.picking_ids.filtered(
|
|
||||||
lambda w: w.state not in ['done',
|
|
||||||
'cancel'])) == 0 and workorder.production_id.programming_state == '已编程':
|
|
||||||
workorder.state = 'ready'
|
|
||||||
purchase_orders_id = self._get_surface_technics_purchase_ids()
|
purchase_orders_id = self._get_surface_technics_purchase_ids()
|
||||||
if purchase_orders_id:
|
if purchase_orders_id:
|
||||||
if purchase_orders_id.state == 'purchase':
|
workorder.state = 'ready' if purchase_orders_id.state == 'purchase' else 'waiting'
|
||||||
move_out = workorder.move_subcontract_workorder_ids[1]
|
else:
|
||||||
for mo in move_out:
|
workorder.state = 'waiting'
|
||||||
if mo.state != 'done':
|
|
||||||
mo.write({'state': 'assigned', 'production_id': False})
|
|
||||||
|
|
||||||
# 重写工单开始按钮方法
|
# 重写工单开始按钮方法
|
||||||
def button_start(self):
|
def button_start(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user