From 9c4c2b85ddedb02be58f17967399a58135a0a96d Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 1 Jul 2024 20:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=B6=E9=80=A0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 8 +++++--- sf_manufacturing/models/mrp_workorder.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 0fa86e78..95242b54 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -111,7 +111,8 @@ class MrpProduction(models.Model): production.state = 'progress' # # 新添加的状态逻辑 - if (production.state == 'to_close' or production.state == 'progress') and production.schedule_state == '未排': + if ( + production.state == 'to_close' or production.state == 'progress') and production.schedule_state == '未排': production.state = 'confirmed' elif production.state == 'to_close' and production.schedule_state == '已排': production.state = 'pending_cam' @@ -120,7 +121,6 @@ class MrpProduction(models.Model): if all(wo_state not in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')): production.state = 'pending_cam' - def action_check(self): """ 审核启用 @@ -630,9 +630,10 @@ class MrpProduction(models.Model): }) for production in self: + logging.info('qty_produced:%s' % production.qty_produced) production.write({ 'date_finished': fields.Datetime.now(), - 'product_qty': production.qty_produced if production.qty_produced < 1 else production.product_qty, + 'product_qty': production.product_qty if production.qty_produced < 1.0 else production.qty_produced, 'priority': '0', 'is_locked': True, 'state': 'done', @@ -658,6 +659,7 @@ class MrpProduction(models.Model): if any(mo.show_allocation for mo in self): action = self.action_view_reception_report() return action + logging.info('last-product_qty:%s' % production.product_qty) return True context = self.env.context.copy() context = {k: v for k, v in context.items() if not k.startswith('default_')} diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 0375b48e..09bde519 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1017,7 +1017,8 @@ class ResMrpWorkOrder(models.Model): record.production_id.process_state = '已完工' if record.routing_type in ['解除装夹', '表面工艺']: raw_move = self.env['stock.move'].sudo().search( - [('origin', '=', record.production_id.name), ('procure_method', '=', 'make_to_order'), + [('origin', '=', record.production_id.name), + ('procure_method', 'in', ['make_to_order', 'make_to_stock']), ('state', '!=', 'done')]) if raw_move: raw_move.write({'state': 'done'})