Accept Merge Request #1634: (feature/制造订单优化 -> develop)

Merge Request: 处理没有工单时,制造订单就已经完成的问题

Created By: @禹翔辉
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1634
This commit is contained in:
禹翔辉
2024-12-25 09:43:29 +08:00
committed by Coding

View File

@@ -381,8 +381,8 @@ class MrpProduction(models.Model):
# 如果制造订单的功能刀具为【无效刀】则制造订单状态改为返工
if production.tool_state == '2':
production.state = 'rework'
if all(wo_state in ('done', 'rework', 'cancel') for wo_state in production.workorder_ids.mapped('state')):
if production.state not in ['scrap', 'rework']:
if production.workorder_ids and all(wo_state in ('done', 'rework', 'cancel') for wo_state in production.workorder_ids.mapped('state')):
if production.state not in ['scrap', 'rework', 'cancel']:
production.state = 'done'