Merge branch 'feature/解决坯料外协不生成外协出库单bug' into feature/解决主流程bug

This commit is contained in:
yuxianghui
2024-05-11 16:36:17 +08:00
3 changed files with 20 additions and 7 deletions

View File

@@ -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')

View File

@@ -77,10 +77,10 @@
<field name="name">工单</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.workorder</field>
<field name="view_mode">tree,kanban,form</field>
<field name="view_mode">tree,form</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('mrp.mrp_production_workorder_tree_editable_view')}),
(0, 0, {'view_mode': 'kanban', 'view_id': ref('mrp.workcenter_line_kanban')}) ]"/>
(0, 0, {'view_mode': 'tree', 'view_id': ref('mrp.mrp_production_workorder_tree_editable_view')}) ]"/>
<!-- (0, 0, {'view_mode': 'kanban', 'view_id': ref('mrp.workcenter_line_kanban')})-->
<!-- <field name="target">fullscreen</field>-->
<field name="target">current</field>
<field name="domain">[('state', '!=', 'cancel'),('schedule_state', '=', '已排')]</field>

View File

@@ -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