Accept Merge Request #1840: (feature/tool_standard_library_process -> 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/1840
This commit is contained in:
@@ -17,7 +17,6 @@ from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.addons.sf_mrs_connect.models.ftp_operate import FtpController
|
||||
|
||||
|
||||
|
||||
class ResMrpWorkOrder(models.Model):
|
||||
_inherit = 'mrp.workorder'
|
||||
_order = 'sequence asc'
|
||||
@@ -91,7 +90,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
('state', '!=', 'cancel')
|
||||
])
|
||||
finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None)
|
||||
if not finish_move and not cur_workorder.is_subcontract and not cur_workorder.name =='解除装夹':
|
||||
if not finish_move and not cur_workorder.is_subcontract and not cur_workorder.name == '解除装夹':
|
||||
record.back_button_display = True
|
||||
else:
|
||||
record.back_button_display = any(
|
||||
@@ -104,15 +103,19 @@ class ResMrpWorkOrder(models.Model):
|
||||
record.back_button_display = True
|
||||
else:
|
||||
record.back_button_display = False
|
||||
if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹':
|
||||
record.back_button_display = False
|
||||
else:
|
||||
next_workorder = sorted_workorders[position + 1]
|
||||
next_state = next_workorder.state
|
||||
if ((next_state == 'ready' and not next_workorder.is_subcontract and not next_workorder.name =='解除装夹') or (next_workorder.state == 'pending' and next_workorder.is_subcontract and not next_workorder.name =='解除装夹')) and cur_workorder.state == 'done':
|
||||
if (next_state == 'ready' or (
|
||||
next_workorder.state == 'pending' and next_workorder.is_subcontract)) and cur_workorder.state == 'done':
|
||||
record.back_button_display = True
|
||||
else:
|
||||
record.back_button_display = False
|
||||
if cur_workorder.is_subcontract or cur_workorder.name =='解除装夹':
|
||||
if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹':
|
||||
record.back_button_display = False
|
||||
|
||||
date_planned_start = fields.Datetime(tracking=True)
|
||||
|
||||
@api.depends('processing_panel')
|
||||
@@ -149,10 +152,10 @@ class ResMrpWorkOrder(models.Model):
|
||||
])
|
||||
finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None) or []
|
||||
if any(
|
||||
finish_move.move_dest_ids.ids in move.ids
|
||||
for picking in finished_product_area
|
||||
for move in picking.move_ids
|
||||
):
|
||||
finish_move.move_dest_ids.ids in move.ids
|
||||
for picking in finished_product_area
|
||||
for move in picking.move_ids
|
||||
):
|
||||
raise UserError('已入库,无法回退')
|
||||
else:
|
||||
moves = self.env['stock.move'].search([
|
||||
@@ -576,6 +579,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
|
||||
detailed_reason = fields.Text('详细原因')
|
||||
is_rework = fields.Boolean(string='是否返工', default=False)
|
||||
|
||||
# rework_flag = fields.Boolean(string='返工标志', compute='_compute_rework_flag')
|
||||
#
|
||||
# @api.depends('state', 'production_line_state')
|
||||
@@ -1265,6 +1269,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
mo.get_move_line(workorder.production_id, workorder))
|
||||
else:
|
||||
workorder.state = 'waiting'
|
||||
|
||||
# 重写工单开始按钮方法
|
||||
def button_start(self):
|
||||
# 判断工单状态是否为等待组件
|
||||
@@ -1431,7 +1436,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
'detailed_reason': record.detailed_reason,
|
||||
'processing_panel': record.processing_panel,
|
||||
'routing_type': record.routing_type,
|
||||
'handle_result': '待处理' if record.test_results in ['返工', '报废'] or record.is_rework is True else '',
|
||||
'handle_result': '待处理' if record.test_results in ['返工',
|
||||
'报废'] or record.is_rework is True else '',
|
||||
'test_results': record.test_results,
|
||||
'test_report': record.detection_report})],
|
||||
'is_scrap': True if record.test_results == '报废' else False
|
||||
@@ -1448,7 +1454,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
raise UserError('请先完成该工单的工艺外协再进行操作')
|
||||
# 表面工艺外协,最后一张工单
|
||||
workorders = self.production_id.workorder_ids
|
||||
subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True and wo.state != 'cancel').sorted('sequence')
|
||||
subcontract_workorders = workorders.filtered(
|
||||
lambda wo: wo.is_subcontract == True and wo.state != 'cancel').sorted('sequence')
|
||||
if self == subcontract_workorders[-1]:
|
||||
# 给下一个库存移动就绪
|
||||
self.move_subcontract_workorder_ids[0].move_dest_ids._action_done()
|
||||
@@ -1671,6 +1678,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
# 根据工单对应的【作业_个性化记录】配置页签
|
||||
if any(item.code == 'PTD' for item in mw.routing_workcenter_id.individuation_page_ids):
|
||||
mw.individuation_page_PTD = True
|
||||
|
||||
# =============================================================================================
|
||||
|
||||
is_inspect = fields.Boolean('需送检', compute='_compute_is_inspect', store=True, default=False)
|
||||
|
||||
Reference in New Issue
Block a user