diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py index 2e99de70..aa8d36b8 100644 --- a/sf_sale/models/sale_order.py +++ b/sf_sale/models/sale_order.py @@ -370,11 +370,12 @@ class RePurchaseOrder(models.Model): move_id.put_move_line() for line in item.order_line: if line.product_id.categ_type == '表面工艺': - for production_name in item.origin.split(','): - production = self.env['mrp.production'].search([('name', '=', production_name)]) - for workorder in production.workorder_ids.filtered( - lambda wd: wd.routing_type == '表面工艺' and wd.state == 'waiting' and line.product_id.server_product_process_parameters_id == wd.surface_technics_parameters_id): - workorder.state = 'ready' + if item.origin: + for production_name in item.origin.split(','): + production = self.env['mrp.production'].search([('name', '=', production_name)]) + for workorder in production.workorder_ids.filtered( + lambda wd: wd.routing_type == '表面工艺' and wd.state == 'waiting' and line.product_id.server_product_process_parameters_id == wd.surface_technics_parameters_id): + workorder.state = 'ready' return result