Accept Merge Request #1849: (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/1849
This commit is contained in:
廖丹龙
2025-02-25 16:40:12 +08:00
committed by Coding
4 changed files with 31 additions and 9 deletions

View File

@@ -103,7 +103,11 @@ class ResMrpWorkOrder(models.Model):
record.back_button_display = True
else:
record.back_button_display = False
if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹':
# tag_type
if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹' or any(
detection_result.processing_panel == cur_workorder.processing_panel and detection_result.routing_type == cur_workorder.routing_type and cur_workorder.tag_type !='重新加工'
for detection_result in cur_workorder.production_id.detection_result_ids
):
record.back_button_display = False
else:
next_workorder = sorted_workorders[position + 1]
@@ -113,7 +117,10 @@ class ResMrpWorkOrder(models.Model):
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 == '解除装夹' or any(
detection_result.processing_panel == cur_workorder.processing_panel and detection_result.routing_type == cur_workorder.routing_type and cur_workorder.tag_type !='重新加工'
for detection_result in cur_workorder.production_id.detection_result_ids
):
record.back_button_display = False
date_planned_start = fields.Datetime(tracking=True)

View File

@@ -646,6 +646,16 @@ class StockPicking(models.Model):
stock_picking = stock_picking_list.filtered(lambda p: p.state not in ("done", "cancel"))
if sale_id and not stock_picking:
sale_id.write({'state': 'delivered'})
if self.location_dest_id.name == '成品存货区' and self.state == 'done':
for move in self.move_ids:
for production in self.sale_order_id.mrp_production_ids:
moves = self.env['stock.move'].search([
('name', '=', production.name),
('state', '!=', 'cancel')
])
finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None)
if finish_move.id in move.move_orig_ids.ids and finish_move.state == 'done':
production.workorder_ids.write({'back_button_display': False})
return res
# 创建 外协出库入单