Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修复工件配送按钮显示

This commit is contained in:
jinling.yang
2024-07-24 15:07:05 +08:00
6 changed files with 342 additions and 456 deletions

View File

@@ -34,8 +34,9 @@ class MrpProduction(models.Model):
@api.depends('workorder_ids.tool_state')
def _compute_tool_state(self):
# if self.workorder_ids:
for item in self:
if item:
if item.workorder_ids:
workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工'))
if workorder_ids.filtered(lambda a: a.tool_state == '2'):
item.tool_state = '2'

View File

@@ -827,6 +827,7 @@ class ResMrpWorkOrder(models.Model):
# workorder.state = 'waiting'
# if workorder.routing_type == 'CNC加工' and workorder.state == 'progress':
# workorder.state = 'to be detected'
# for workorder in self:
# if workorder.is_rework is True and workorder.state == 'done':
# cnc_work = self.env['mrp.workorder'].search([('routing_type','=','CNC加工'),('production_id','=',workorder.production_id.id)])
@@ -865,12 +866,10 @@ class ResMrpWorkOrder(models.Model):
limit=1, order='id asc')
if not cnc_workorder.cnc_ids:
raise UserError(_('该制造订单还未下发CNC程序请稍后再试'))
# else:
# for item in cnc_workorder.cnc_ids:
# functional_cutting_tool = self.env['sf.functional.cutting.tool.entity'].search(
# [('tool_name_id.name', '=', item.cutting_tool_name)])
# if not functional_cutting_tool:
# raise UserError(_('该制造订单的CNC程序为%s没有对应的功能刀具' % item.cutting_tool_name))
else:
if self.production_id.tool_state in ['1', '2']:
raise UserError(
f'制造订单【{self.production_id.name}】功能刀具状态为【{self.production_id.tool_state}】!')
if self.routing_type == '解除装夹':
'''
记录开始时间