From 5f9c5961a52e81e7b5820a667d314ff1b6b6e117 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Fri, 9 Aug 2024 10:39:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=BA=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 3 +++ sf_manufacturing/models/stock.py | 3 +-- sf_manufacturing/wizard/production_wizard.py | 3 ++- sf_manufacturing/wizard/production_wizard_views.xml | 5 ++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index e1464f3f..4caa5499 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -187,6 +187,9 @@ class MrpProduction(models.Model): production.state = 'rework' if any(wo.test_results == '报废' and wo.state == 'done' for wo in production.workorder_ids): production.state = 'scrap' + if any(dr.test_results == '报废' and dr.handle_result == '已处理' for dr in + production.detection_result_ids): + production.state = 'cancel' # 如果制造订单的功能刀具为【无效刀】则制造订单状态改为返工 if production.tool_state == '2': production.state = 'rework' diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index aea42c6f..9d401682 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -533,8 +533,7 @@ class ProductionLot(models.Model): class StockPicking(models.Model): _inherit = 'stock.picking' - # workorder_in_id = fields.One2many('mrp.workorder', 'picking_in_id') - # workorder_out_id = fields.One2many('mrp.workorder', 'picking_out_id') + surface_technics_parameters_id = fields.Many2one('sf.production.process.parameter', string="表面工艺可选参数") # 设置外协出入单的名称 def _get_name_Res(self, rescode): diff --git a/sf_manufacturing/wizard/production_wizard.py b/sf_manufacturing/wizard/production_wizard.py index 51a79464..aa484a9e 100644 --- a/sf_manufacturing/wizard/production_wizard.py +++ b/sf_manufacturing/wizard/production_wizard.py @@ -19,7 +19,8 @@ class ProductionWizard(models.TransientModel): self.production_id.update_programming_state() self.production_id.action_cancel() self.production_id.detection_result_ids.write({'handle_result': '已处理'}) - self.production_id.write({'scrap_ids': [(0, 0, { + self.production_id.write({'state': 'cancel', 'scrap_ids': [(0, 0, { + 'name': self.env['ir.sequence'].next_by_code('stock.scrap') or _('New'), 'product_id': self.production_id.product_id.id, 'scrap_qty': 1, 'lot_id': self.production_id.move_line_raw_ids.lot_id.id, diff --git a/sf_manufacturing/wizard/production_wizard_views.xml b/sf_manufacturing/wizard/production_wizard_views.xml index 57b547dc..94bf4245 100644 --- a/sf_manufacturing/wizard/production_wizard_views.xml +++ b/sf_manufacturing/wizard/production_wizard_views.xml @@ -6,7 +6,7 @@
- +
重新生成制造订单 @@ -28,6 +28,9 @@ 报废 sf.production.wizard form + { + 'default_production_id': active_id} + new