1、优化工单子页签可全量配置处理方法;
This commit is contained in:
@@ -1442,7 +1442,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
record.production_id.process_state = '待加工'
|
||||
# 生成工件配送单
|
||||
record.workpiece_delivery_ids = record._json_workpiece_delivery_list()
|
||||
if record.routing_type == 'CNC加工' or 'PTD' in record.individuation_page_list:
|
||||
if (record.routing_type == 'CNC加工' or
|
||||
(record.individuation_page_list and 'PTD' in record.individuation_page_list)):
|
||||
if record.routing_type == 'CNC加工':
|
||||
record.process_state = '待解除装夹'
|
||||
# record.write({'process_state': '待加工'})
|
||||
@@ -1675,32 +1676,31 @@ class ResMrpWorkOrder(models.Model):
|
||||
move_subcontract_workorder_ids = fields.One2many('stock.move', 'subcontract_workorder_id', string='组件')
|
||||
|
||||
# ==============================配置化页签--个性化记录===================================
|
||||
routing_workcenter_id = fields.Many2one('mrp.routing.workcenter', compute='_compute_routing_workcenter_id',
|
||||
store=True, string='工序作业')
|
||||
individuation_page_ids = fields.Many2many('sf.work.individuation.page', string='个性化记录', store=True,
|
||||
compute='_compute_individuation_page_ids')
|
||||
individuation_page_list = fields.Char('个性化记录', default=None)
|
||||
routing_work_center_id = fields.Many2one('mrp.routing.workcenter', compute='_compute_routing_work_center_id',
|
||||
store=True, string='工序作业')
|
||||
individuation_page_ids = fields.Many2many('sf.work.individuation.page', string='个性化记录',
|
||||
related='routing_work_center_id.individuation_page_ids')
|
||||
individuation_page_list = fields.Char('个性化记录', default='', compute='_compute_individuation_page_ids', store=True)
|
||||
|
||||
@api.depends('name')
|
||||
def _compute_routing_workcenter_id(self):
|
||||
def _compute_routing_work_center_id(self):
|
||||
for mw in self:
|
||||
routing_workcenter_id = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', mw.name), ('routing_type', '=', mw.routing_type)])
|
||||
if routing_workcenter_id:
|
||||
mw.routing_workcenter_id = routing_workcenter_id.id
|
||||
if not mw.routing_work_center_id and mw.name:
|
||||
routing_work_center_id = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', 'in', mw.name.split('-')), ('routing_type', '=', mw.routing_type)])
|
||||
if routing_work_center_id:
|
||||
mw.routing_work_center_id = routing_work_center_id.id
|
||||
|
||||
@api.depends('routing_workcenter_id.individuation_page_ids')
|
||||
@api.depends('individuation_page_ids')
|
||||
def _compute_individuation_page_ids(self):
|
||||
for mw in self:
|
||||
if mw.routing_workcenter_id:
|
||||
mw.individuation_page_ids = mw.routing_workcenter_id.individuation_page_ids.ids
|
||||
# 初始化页签配置
|
||||
mw.individuation_page_list = None
|
||||
# 根据工单对应的【作业_个性化记录】配置页签
|
||||
individuation_page_list = [item.code for item in mw.routing_workcenter_id.individuation_page_ids]
|
||||
if individuation_page_list:
|
||||
mw.individuation_page_list = list(set(individuation_page_list))
|
||||
|
||||
mw.individuation_page_list = '[]'
|
||||
if mw.routing_work_center_id:
|
||||
if mw.individuation_page_ids:
|
||||
# 根据工单对应的【作业_个性化记录】配置页签
|
||||
individuation_page_list = [item.code for item in mw.individuation_page_ids]
|
||||
if individuation_page_list:
|
||||
mw.individuation_page_list = list(set(individuation_page_list))
|
||||
# =============================================================================================
|
||||
|
||||
is_inspect = fields.Boolean('需送检', compute='_compute_is_inspect', store=True, default=False)
|
||||
@@ -2010,7 +2010,7 @@ class WorkPieceDelivery(models.Model):
|
||||
feeder_station_destination_id = fields.Many2one('sf.agv.site', '目的接驳站')
|
||||
task_delivery_time = fields.Datetime('任务下发时间')
|
||||
task_completion_time = fields.Datetime('任务完成时间')
|
||||
|
||||
|
||||
def _get_agv_route_type_selection(self):
|
||||
return self.env['sf.agv.task.route'].fields_get(['route_type'])['route_type']['selection']
|
||||
type = fields.Selection(selection=_get_agv_route_type_selection, string='类型')
|
||||
|
||||
Reference in New Issue
Block a user