From e02f79230054731ba37aed6055945e6f1f3a63df Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Thu, 11 Jul 2024 11:22:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= 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 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 36bdb13d..6ccd40df 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -122,6 +122,9 @@ class MrpProduction(models.Model): if production.state == 'progress': if all(wo_state not in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')): production.state = 'pending_cam' + if production.state == 'pending_cam': + if all(wo_state in 'done' for wo_state in production.workorder_ids.mapped('state')): + production.state = 'done' def action_check(self): """ diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index c6c8ec6b..a1543b8f 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -204,7 +204,8 @@ class StockRule(models.Model): productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create( productions_values) - self.env['stock.move'].sudo().create(productions._get_moves_raw_values()) + # self.env['stock.move'].sudo().create(productions._get_moves_raw_values()) + self.env['stock.move'].sudo().create(productions._get_moves_finished_values()) ''' 创建工单