From 566bc0e1e22d499a3b6de86337c0143e8ad9e064 Mon Sep 17 00:00:00 2001 From: guanhuan Date: Thu, 19 Jun 2025 09:40:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E9=9C=80=E6=B1=82=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/sf_production_demand_plan.py | 17 ++++++++++++----- sf_demand_plan/views/demand_plan.xml | 8 +++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/sf_demand_plan/models/sf_production_demand_plan.py b/sf_demand_plan/models/sf_production_demand_plan.py index 52dc85b9..72c6593f 100644 --- a/sf_demand_plan/models/sf_production_demand_plan.py +++ b/sf_demand_plan/models/sf_production_demand_plan.py @@ -39,11 +39,7 @@ class SfProductionDemandPlan(models.Model): company_id = fields.Many2one( related='sale_order_id.company_id', store=True, index=True, precompute=True) - partner_id = fields.Many2one( - comodel_name='res.partner', - related='sale_order_line_id.order_partner_id', - string="客户", - store=True, index=True) + customer_name = fields.Char('客户', related='sale_order_id.customer_name') order_remark = fields.Text(related='sale_order_id.remark', string="订单备注", store=True) glb_url = fields.Char(related='sale_order_line_id.glb_url', string='glb文件地址') @@ -74,6 +70,9 @@ class SfProductionDemandPlan(models.Model): qty_to_deliver = fields.Float( "待交货数量", related='sale_order_line_id.qty_to_deliver') model_long = fields.Char('尺寸', compute='_compute_model_long') + blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类', + related='product_id.blank_type') + embryo_long = fields.Char('坯料尺寸', compute='_compute_embryo_long') materials_id = fields.Char('材料', compute='_compute_materials_id', store=True) model_machining_precision = fields.Selection(selection=_get_machining_precision, string='精度', related='product_id.model_machining_precision') @@ -197,6 +196,14 @@ class SfProductionDemandPlan(models.Model): else: line.model_long = None + @api.depends('product_id.model_long', 'product_id.model_width', 'product_id.model_height') + def _compute_embryo_long(self): + for line in self: + if line.product_id: + line.embryo_long = f"{round(line.product_id.model_long, 3)}*{round(line.product_id.model_width, 3)}*{round(line.product_id.model_height, 3)}" + else: + line.embryo_long = None + @api.depends('product_id.materials_id') def _compute_materials_id(self): for line in self: diff --git a/sf_demand_plan/views/demand_plan.xml b/sf_demand_plan/views/demand_plan.xml index c0b1e5a9..24a2707e 100644 --- a/sf_demand_plan/views/demand_plan.xml +++ b/sf_demand_plan/views/demand_plan.xml @@ -13,7 +13,7 @@ - + @@ -28,6 +28,8 @@ + + @@ -80,7 +82,7 @@ - + @@ -89,7 +91,7 @@ - +