From f487ab4ccefe36944a985115f8e11fc2bcfdaa63 Mon Sep 17 00:00:00 2001 From: chenye Date: Mon, 14 Jul 2025 14:15:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A47268,7271=E7=AD=89bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_demand_plan/models/mrp_bom.py | 4 ++-- sf_demand_plan/models/sf_demand_plan.py | 3 +++ sf_demand_plan/models/sf_production_demand_plan.py | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sf_demand_plan/models/mrp_bom.py b/sf_demand_plan/models/mrp_bom.py index 3368653b..5fb3a6d5 100644 --- a/sf_demand_plan/models/mrp_bom.py +++ b/sf_demand_plan/models/mrp_bom.py @@ -23,7 +23,7 @@ class MrpBom(models.Model): """重写name_get方法,只显示BOM编码""" result = [] for record in self: - # 只显示BOM编码,如果编码为空则显示名称 - display_name = record.code or record.name or f'BOM-{record.id}' + # 只显示BOM编码,如果编码为空则显示产品名称 + display_name = record.code or record.product_tmpl_id.name or f'BOM-{record.id}' result.append((record.id, display_name)) return result \ No newline at end of file diff --git a/sf_demand_plan/models/sf_demand_plan.py b/sf_demand_plan/models/sf_demand_plan.py index 088ad0d6..e7be1cda 100644 --- a/sf_demand_plan/models/sf_demand_plan.py +++ b/sf_demand_plan/models/sf_demand_plan.py @@ -219,6 +219,9 @@ class SfDemandPlan(models.Model): line_ids = self.line_ids.filtered(lambda p: p.status == '30') sum_product_uom_qty = sum(line_ids.mapped('plan_uom_qty')) customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers') + for line in self.line_ids: + if line.manual_quotation and line.custom_made_type == 'automation': + raise ValidationError(f"产品{line.product_id.name}为人工编程,不能选择自动化产线加工") if not self.overdelivery_allowed and line_ids.filtered(lambda p: p.location_id.id == customer_location_id): if float_compare(sum_product_uom_qty, self.product_uom_qty, precision_rounding=self.product_id.uom_id.rounding) == 1: diff --git a/sf_demand_plan/models/sf_production_demand_plan.py b/sf_demand_plan/models/sf_production_demand_plan.py index 28c733c8..d7de2de2 100644 --- a/sf_demand_plan/models/sf_production_demand_plan.py +++ b/sf_demand_plan/models/sf_production_demand_plan.py @@ -21,7 +21,7 @@ class SfProductionDemandPlan(models.Model): status = fields.Selection([ ('10', '草稿'), ('20', '待确认'), - ('30', '需求确认'), + ('30', '待工艺设计'), ('50', '待下达生产'), ('60', '已下达'), ('100', '取消'), @@ -587,7 +587,7 @@ class SfProductionDemandPlan(models.Model): def unlink(self): for item in self: if item.status not in ('10', '20', '30'): - raise ValidationError(u'只能删除状态为【草稿,待确认,需求确认】的需求计划。') + raise ValidationError(u'只能删除状态为【草稿,待确认,待工艺设计】的需求计划。') else: super(SfProductionDemandPlan, item).unlink()