sf优化绑定托盘,工单form显示开始按钮 加工时间
This commit is contained in:
@@ -171,7 +171,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
'domain': [('workorder_id', '=', self.id)]
|
||||
}
|
||||
|
||||
tray_id = fields.Many2one('sf.tray', string="托盘信息")
|
||||
tray_id = fields.Many2one('sf.tray', string="托盘信息", tracking=True)
|
||||
|
||||
# 扫码绑定托盘方法
|
||||
|
||||
@@ -189,6 +189,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
'production_id': self.production_id,
|
||||
'state': '占用',
|
||||
})
|
||||
self.work_state = "已绑定"
|
||||
orders = self.env['mrp.workorder'].search([('production_id', '=', self.production_id.id)])
|
||||
for a in orders:
|
||||
a.tray_id = values
|
||||
@@ -288,7 +289,16 @@ class ResMrpWorkOrder(models.Model):
|
||||
self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||
productions._create_workorder2(self.processing_panel)
|
||||
else:
|
||||
return True
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': '工单详情',
|
||||
'res_model': 'mrp.workorder',
|
||||
'view_mode': 'tree',
|
||||
'context': {'active_id': self.id},
|
||||
'domain': [('state', 'not in', ['done', 'cancel', 'waiting', 'pending'])],
|
||||
'target': 'current',
|
||||
|
||||
}
|
||||
|
||||
# cnc程序获取
|
||||
def fetchCNC(self):
|
||||
@@ -363,7 +373,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
|
||||
# 重写工单开始按钮方法
|
||||
def button_start(self):
|
||||
if self.state == 'waiting' or self.state == 'ready':
|
||||
if self.state == 'waiting' or self.state == 'ready' or self.state == 'progress':
|
||||
self.ensure_one()
|
||||
if any(not time.date_end for time in self.time_ids.filtered(lambda t: t.user_id.id == self.env.user.id)):
|
||||
return True
|
||||
@@ -408,7 +418,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
vals['date_planned_finished'] = start_date
|
||||
return self.write(vals)
|
||||
else:
|
||||
raise ValidationError(_('请先完成上一步工单'))
|
||||
raise UserError(_('请先完成上一步工单'))
|
||||
|
||||
|
||||
class CNCprocessing(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user