From f1390e47c92393267c49130003b2eaf27579079f Mon Sep 17 00:00:00 2001 From: chenye Date: Fri, 11 Jul 2025 16:36:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A47252bug=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_demand_plan/models/sf_demand_plan.py | 3 +++ sf_demand_plan/models/sf_production_demand_plan.py | 4 +++- sf_demand_plan/views/demand_plan.xml | 1 + sf_demand_plan/views/demand_plan_info.xml | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sf_demand_plan/models/sf_demand_plan.py b/sf_demand_plan/models/sf_demand_plan.py index 9b6cc17f..0039e51e 100644 --- a/sf_demand_plan/models/sf_demand_plan.py +++ b/sf_demand_plan/models/sf_demand_plan.py @@ -36,6 +36,9 @@ class SfDemandPlan(models.Model): blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类', related='product_id.blank_type') + blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型', + related='product_id.blank_precision') + manual_quotation = fields.Boolean('人工编程',related='product_id.manual_quotation', default=False) embryo_long = fields.Char('坯料尺寸(mm)', compute='_compute_embryo_long', store=True) is_incoming_material = fields.Boolean('客供料', related='sale_order_line_id.is_incoming_material', store=True) pending_qty = fields.Float( diff --git a/sf_demand_plan/models/sf_production_demand_plan.py b/sf_demand_plan/models/sf_production_demand_plan.py index 1d4b616a..28c733c8 100644 --- a/sf_demand_plan/models/sf_production_demand_plan.py +++ b/sf_demand_plan/models/sf_production_demand_plan.py @@ -169,7 +169,7 @@ class SfProductionDemandPlan(models.Model): finished_product_arrival_date = fields.Date('采购计划到货(成品)') bom_id = fields.Many2one('mrp.bom', string="BOM", readonly=True) location_id = fields.Many2one('stock.location', string='需求位置', default=get_location_id, readonly=True) - + manual_quotation = fields.Boolean('人工编程',related='product_id.manual_quotation',default=False) @api.constrains('plan_uom_qty') def _check_plan_uom_qty(self): line_ids = self.filtered(lambda p: p.plan_uom_qty == 0 or p.plan_uom_qty < 0) @@ -642,6 +642,8 @@ class SfProductionDemandPlan(models.Model): self.ensure_one() if not self.new_supply_method: raise ValidationError(f"供货方式不能为空!") + if self.product_id.manual_quotation and self.custom_made_type == 'automation': + raise ValidationError(f"产品{self.product_id.name}为人工编程,不能选择自动化产线加工") check_overdelivery_allowed = False if not self.demand_plan_id.overdelivery_allowed: customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers') diff --git a/sf_demand_plan/views/demand_plan.xml b/sf_demand_plan/views/demand_plan.xml index da16fc8a..146ece76 100644 --- a/sf_demand_plan/views/demand_plan.xml +++ b/sf_demand_plan/views/demand_plan.xml @@ -22,6 +22,7 @@ + diff --git a/sf_demand_plan/views/demand_plan_info.xml b/sf_demand_plan/views/demand_plan_info.xml index 414e60d1..1c4d8976 100644 --- a/sf_demand_plan/views/demand_plan_info.xml +++ b/sf_demand_plan/views/demand_plan_info.xml @@ -20,7 +20,9 @@ - + + +