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:
@@ -103,7 +103,11 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
record.back_button_display = True
|
record.back_button_display = True
|
||||||
else:
|
else:
|
||||||
record.back_button_display = False
|
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
|
record.back_button_display = False
|
||||||
else:
|
else:
|
||||||
next_workorder = sorted_workorders[position + 1]
|
next_workorder = sorted_workorders[position + 1]
|
||||||
@@ -113,7 +117,10 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
record.back_button_display = True
|
record.back_button_display = True
|
||||||
else:
|
else:
|
||||||
record.back_button_display = False
|
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
|
record.back_button_display = False
|
||||||
|
|
||||||
date_planned_start = fields.Datetime(tracking=True)
|
date_planned_start = fields.Datetime(tracking=True)
|
||||||
|
|||||||
@@ -646,6 +646,16 @@ class StockPicking(models.Model):
|
|||||||
stock_picking = stock_picking_list.filtered(lambda p: p.state not in ("done", "cancel"))
|
stock_picking = stock_picking_list.filtered(lambda p: p.state not in ("done", "cancel"))
|
||||||
if sale_id and not stock_picking:
|
if sale_id and not stock_picking:
|
||||||
sale_id.write({'state': 'delivered'})
|
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
|
return res
|
||||||
|
|
||||||
# 创建 外协出库入单
|
# 创建 外协出库入单
|
||||||
|
|||||||
@@ -202,10 +202,11 @@
|
|||||||
attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked')]}"/>
|
attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked')]}"/>
|
||||||
<button name="do_inspect" type="object" string="送检" class="btn-success" confirm="是否确认送检"
|
<button name="do_inspect" type="object" string="送检" class="btn-success" confirm="是否确认送检"
|
||||||
attrs="{'invisible': ['|', '|', ('state', 'not in', ('progress')), ('is_inspect', '=', False), ('routing_type','=','CNC加工')]}"/>
|
attrs="{'invisible': ['|', '|', ('state', 'not in', ('progress')), ('is_inspect', '=', False), ('routing_type','=','CNC加工')]}"/>
|
||||||
|
<button name="do_inspect" type="object" string="送检" class="btn-success" confirm="是否确认送检"
|
||||||
<!-- <button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="停工" -->
|
attrs="{'invisible': ['|', '|', ('state', 'not in', ('progress')), ('is_inspect', '=', False), ('production_line_state','!=','已下产线')]}"/>
|
||||||
<!-- context="{'default_workcenter_id': workcenter_id}" class="btn-danger" -->
|
<!-- <button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="停工" -->
|
||||||
<!-- groups="sf_base.group_sf_mrp_user" -->
|
<!-- context="{'default_workcenter_id': workcenter_id}" class="btn-danger" -->
|
||||||
|
<!-- groups="sf_base.group_sf_mrp_user" -->
|
||||||
<!-- attrs="{'invisible': ['|', ('production_state', '!=', 'pending_processing'), ('state','!=','progress')]}"/> -->
|
<!-- attrs="{'invisible': ['|', ('production_state', '!=', 'pending_processing'), ('state','!=','progress')]}"/> -->
|
||||||
<!-- <button name="button_unblock" type="object" string="Unblock" -->
|
<!-- <button name="button_unblock" type="object" string="Unblock" -->
|
||||||
<!-- context="{'default_workcenter_id': workcenter_id}" class="btn-danger" -->
|
<!-- context="{'default_workcenter_id': workcenter_id}" class="btn-danger" -->
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from itertools import groupby
|
from itertools import groupby
|
||||||
from odoo import models, api, fields, _
|
from odoo import models, api, fields, _
|
||||||
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
class ProductionTechnologyWizard(models.TransientModel):
|
class ProductionTechnologyWizard(models.TransientModel):
|
||||||
@@ -88,7 +89,10 @@ class ProductionTechnologyWizard(models.TransientModel):
|
|||||||
for item in productions:
|
for item in productions:
|
||||||
workorder = item.workorder_ids.filtered(lambda wo: wo.state not in ('cancel')).sorted(
|
workorder = item.workorder_ids.filtered(lambda wo: wo.state not in ('cancel')).sorted(
|
||||||
key=lambda a: a.sequence)
|
key=lambda a: a.sequence)
|
||||||
if workorder[0].state in ['pending']:
|
first_element = workorder[0] if workorder else None
|
||||||
if workorder[0].production_id.product_id.categ_id.type == '成品' and item.programming_state != '已编程':
|
if not first_element:
|
||||||
workorder[0].state = 'waiting'
|
raise UserError('工艺确认后,工单未生成,请检查配置')
|
||||||
|
if first_element.state in ['pending']:
|
||||||
|
if first_element.production_id.product_id.categ_id.type == '成品' and item.programming_state != '已编程':
|
||||||
|
first_element.state = 'waiting'
|
||||||
return productions
|
return productions
|
||||||
|
|||||||
Reference in New Issue
Block a user