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()) ''' 创建工单