1、处理大批量修改cnc编程单的工单状态时,导致工单状态的自动计算方法进行递归而产生的栈溢出问题
This commit is contained in:
@@ -263,8 +263,17 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
if self.tool_name_id.name:
|
||||
cnc_processing_ids = self.env['sf.cnc.processing'].search(
|
||||
[('tool_state', '=', '1'), ('cutting_tool_name', '=', self.tool_name_id.name)])
|
||||
production_ids = []
|
||||
if cnc_processing_ids:
|
||||
cnc_processing_ids.sudo().write({'tool_state': '0'})
|
||||
for item in cnc_processing_ids:
|
||||
if item.workorder_id and item.workorder_id.production_id not in production_ids:
|
||||
production_ids.append(item.workorder_id.production_id)
|
||||
if production_ids:
|
||||
# 对同一制造订单的工单的cnc编程单的功能刀具状态进行变更,并调用工单的功能刀具状态计算方法
|
||||
for production_id in production_ids:
|
||||
cnc_ids = cnc_processing_ids.filtered(lambda a: a.workorder_id.production_id == production_id)
|
||||
cnc_ids.sudo().write({'tool_state': '0'})
|
||||
cnc_ids.workorder_id._compute_tool_state()
|
||||
|
||||
def tool_inventory_displacement_out(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user