From def9bd2c6ea63379736546dbe9426f8b378f49b1 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Wed, 26 Feb 2025 09:09:26 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9D=AF=E6=96=99=E8=87=AA=E5=8A=A0=E5=B7=A5?=
=?UTF-8?q?=E7=9A=84=E5=88=87=E5=89=B2=E5=B7=A5=E5=BA=8F=E7=8A=B6=E6=80=81?=
=?UTF-8?q?=E4=B9=9F=E5=88=A4=E6=96=AD=E4=BA=86=E7=BC=96=E7=A8=8B=E7=8A=B6?=
=?UTF-8?q?=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/mrp_production.py | 17 +++++++++++++++++
sf_manufacturing/models/mrp_workorder.py | 1 +
.../views/mrp_production_addional_change.xml | 11 +++++++----
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 8bec3e65..c1d3ee33 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -265,6 +265,23 @@ class MrpProduction(models.Model):
part_name = fields.Char(string='零件名称', related='product_id.part_name', readonly=True)
+ # 判断制造的产品类型
+ production_product_type = fields.Selection([
+ ('成品', '成品'),
+ ('坯料', '坯料'),
+ ('其他', '其他')
+ ], string='产品类型', default='成品')
+
+ @api.onchange('product_id')
+ def onchange_product_id(self):
+ for record in self:
+ if record.product_id.categ_id.type == '成品':
+ record.production_product_type = '成品'
+ elif record.product_id.categ_id.type == '坯料':
+ record.production_product_type = '坯料'
+ else:
+ record.production_product_type = '其他'
+
@api.depends('product_id.manual_quotation')
def _compute_manual_quotation(self):
for item in self:
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 9a7c949d..22fe0777 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -1210,6 +1210,7 @@ class ResMrpWorkOrder(models.Model):
# ================= 如果制造订单制造类型为【人工线下加工】==========================
if (workorder.production_id.production_type == '人工线下加工'
and workorder.production_id.schedule_state == '已排'
+ and workorder.routing_type == '人工线下加工'
and len(workorder.production_id.picking_ids.filtered(
lambda w: w.state not in ['done', 'cancel'])) == 0
and workorder.production_id.programming_state == '已编程'):
diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml
index e3b29c93..2d048153 100644
--- a/sf_manufacturing/views/mrp_production_addional_change.xml
+++ b/sf_manufacturing/views/mrp_production_addional_change.xml
@@ -116,12 +116,13 @@
+
+ attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工']), ('production_product_type', '!=', '成品')]}"/>
+ attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工']), ('production_product_type', '!=', '成品')]}"/>
@@ -416,7 +417,9 @@
子MO
-
+
+
+