diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index bc1d5eef..fc4ccbeb 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -500,7 +500,8 @@ class MrpProduction(models.Model): # 修改标记已完成方法 def button_mark_done1(self): - self._button_mark_done_sanity_checks() + if not self.workorder_ids.filtered(lambda w: w.routing_type not in ['表面工艺']): + self._button_mark_done_sanity_checks() if not self.env.context.get('button_mark_done_production_ids'): self = self.with_context(button_mark_done_production_ids=self.ids) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index dee1258a..91200885 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -907,6 +907,12 @@ class ResMrpWorkOrder(models.Model): move_raw_id.quantity_done = move_raw_id.product_uom_qty record.process_state = '已完工' 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'), + ('state', '!=', 'done')]) + if raw_move: + raw_move.write({'state': 'done'}) record.production_id.button_mark_done1() # self.production_id.state = 'done' diff --git a/sf_sale/views/sale_order_view.xml b/sf_sale/views/sale_order_view.xml index afa718c6..0981ff59 100644 --- a/sf_sale/views/sale_order_view.xml +++ b/sf_sale/views/sale_order_view.xml @@ -81,12 +81,9 @@ -