From 0ddf2ce1bd9db5036c6fe7ded086c62ad01db3bf Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Sat, 11 May 2024 16:34:29 +0800
Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E7=AD=89=E5=BE=85=E7=BB=84=E4=BB=B6?=
=?UTF-8?q?=E7=8A=B6=E6=80=81=E7=9A=84=E8=A3=85=E5=A4=B9=E9=A2=84=E8=B0=83?=
=?UTF-8?q?=E5=B7=A5=E5=8D=95=E7=82=B9=E5=87=BB=E3=80=90=E5=BC=80=E5=A7=8B?=
=?UTF-8?q?=E3=80=91=E6=97=B6=EF=BC=8C=E6=B2=A1=E6=9C=89=E7=BB=84=E4=BB=B6?=
=?UTF-8?q?=E7=BB=99=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=EF=BC=9B2?=
=?UTF-8?q?=E3=80=81=E9=9A=90=E8=97=8F=E8=A3=85=E5=A4=B9=E9=A2=84=E8=B0=83?=
=?UTF-8?q?=E5=B7=A5=E5=8D=95=E5=88=97=E8=A1=A8=E7=9C=8B=E6=9D=BF=EF=BC=8C?=
=?UTF-8?q?3=E3=80=81=E5=BA=93=E5=AD=98-=E5=86=85=E9=83=A8=E8=B0=83?=
=?UTF-8?q?=E6=8B=A8-=E4=BA=A7=E5=93=81=E6=98=AF=E5=88=80=E5=85=B7?=
=?UTF-8?q?=E7=89=A9=E6=96=99=E9=99=A4=E5=88=80=E6=9F=84=E5=A4=96=EF=BC=8C?=
=?UTF-8?q?=E5=85=B6=E4=BB=96=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99=E7=9B=AE?=
=?UTF-8?q?=E6=A0=87=E8=B4=A7=E4=BD=8D=E6=B7=BB=E5=8A=A0=E5=BF=85=E5=A1=AB?=
=?UTF-8?q?=E6=A0=A1=E9=AA=8C=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/mrp_workorder.py | 11 +++++++++--
sf_manufacturing/views/mrp_workorder_view.xml | 6 +++---
sf_warehouse/models/model.py | 10 ++++++++--
3 files changed, 20 insertions(+), 7 deletions(-)
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