From 5b084624dfd9ff10701ae0bab80fa275369e5bf4 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Wed, 12 Mar 2025 13:46:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=8D=E9=80=81=E6=A3=80=E7=9A=84?= =?UTF-8?q?=E8=B4=A8=E9=87=8F=E6=A3=80=E6=9F=A5=E5=8D=95=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E7=AD=89=E5=BE=85=E3=80=81=E5=BE=85?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index c0c45ac8..4a5d0c0f 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1198,11 +1198,7 @@ class ResMrpWorkOrder(models.Model): 'cmm_ids': production.workorder_ids.filtered(lambda t: t.routing_type == 'CNC加工').cmm_ids, }] return workorders_values_str - - @api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state', - 'production_id.tool_state', 'production_id.schedule_state', 'sequence', - 'production_id.programming_state') - def _compute_state(self): + def _process_compute_state(self): for workorder in self: # 如果工单的工序没有进行排序则跳出循环 if workorder.production_id.workorder_ids.filtered(lambda wk: wk.sequence == 0): @@ -1289,7 +1285,20 @@ class ResMrpWorkOrder(models.Model): mo.get_move_line(workorder.production_id, workorder)) else: workorder.state = 'waiting' - + @api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state', + 'production_id.tool_state', 'production_id.schedule_state', 'sequence', + 'production_id.programming_state') + def _compute_state(self): + self._process_compute_state() + for workorder in self: + if workorder.state == 'waiting' or workorder.state == 'pending': + for check_id in workorder.check_ids: + if not check_id.is_inspect: + check_id.quality_state = 'waiting' + if workorder.state == 'ready': + for check_id in workorder.check_ids: + if not check_id.is_inspect: + check_id.quality_state = 'none' # 重写工单开始按钮方法 def button_start(self): # 判断工单状态是否为等待组件 From 7c48e6b186147cac62946c15584b1ed02eb2eae5 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Thu, 13 Mar 2025 09:49:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=90=8C=E4=B8=80=E4=B8=AA=E9=94=80?= =?UTF-8?q?=E5=94=AE=E8=AE=A2=E5=8D=95=E7=9A=84=E4=B8=8D=E5=90=8C=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E7=9A=84=E5=9D=AF=E6=96=99=E8=8E=B7=E5=8F=96=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E4=B8=8D=E4=B8=80=E6=A0=B7=EF=BC=8C=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=9A=84=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index f8a22b28..433feccc 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -1574,7 +1574,7 @@ class MrpProduction(models.Model): vals['picking_type_id'] = picking_type_id vals['name'] = self.env['stock.picking.type'].browse(picking_type_id).sequence_id.next_by_id() product_id = self.env['product.product'].browse(vals['product_id']) - is_self_process = product_id.materials_type_id and product_id.materials_type_id.gain_way and product_id.materials_type_id.gain_way != '自加工' + is_self_process = product_id.materials_type_id.gain_way if product_id.materials_type_id else None is_customer_provided = product_id.is_customer_provided key = f"{is_self_process}_{is_customer_provided}" if not is_custemer_group_id.get(key):