diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index e10db743..aa084eaf 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -743,9 +743,16 @@ class ResMrpWorkOrder(models.Model): # 重写工单开始按钮方法 def button_start(self): - if self.routing_type == '装夹预调' and self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name: - self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name if self.routing_type == '装夹预调': + # 判断是否有坯料的序列号信息 + boolean = False + if self.production_id.move_raw_ids[0].move_line_ids: + if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name: + boolean = True + if not boolean: + raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name) + self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name + # cnc校验 cnc_workorder = self.search( [('production_id', '=', self.production_id.id), ('routing_type', '=', 'CNC加工')], limit=1, order='id asc') diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index dce2a68a..d17e1f7e 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -77,10 +77,10 @@ 工单 ir.actions.act_window mrp.workorder - tree,kanban,form + tree,form + (0, 0, {'view_mode': 'tree', 'view_id': ref('mrp.mrp_production_workorder_tree_editable_view')}) ]"/> + current [('state', '!=', 'cancel'),('schedule_state', '=', '已排')] diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index e526d5b9..236781ee 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -875,8 +875,14 @@ class SfStockPicking(models.Model): res = super(SfStockPicking, self).button_validate() for line in self.move_line_ids: if line: - # 调用入库方法进行入库 - line.compute_destination_location_id() + if line.destination_location_id: + # 调用入库方法进行入库刀货位 + line.compute_destination_location_id() + else: + # 对除刀柄之外的刀具物料进行 目标货位必填校验 + if self.location_dest_id.name == '刀具房' and line.product_id.cutting_tool_material_id not in ( + '刀柄', False): + raise ValidationError('请选择【%s】产品的目标货位!' % line.product_id.name) if line.current_location_id: if line.current_location_id.product_sn_id: line.current_location_id.product_sn_id = False