From 154a17657c652e253d8fe7112744bc6e0f4a2c33 Mon Sep 17 00:00:00 2001 From: guanhuan Date: Thu, 12 Jun 2025 09:35:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E8=AE=A1=E5=88=92=E6=9D=90?= =?UTF-8?q?=E6=96=99=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E8=A1=8C=E5=8F=96?= =?UTF-8?q?=E5=80=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_demand_plan/models/sf_production_demand_plan.py | 14 +++++++++++--- sf_demand_plan/views/demand_plan.xml | 6 +++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sf_demand_plan/models/sf_production_demand_plan.py b/sf_demand_plan/models/sf_production_demand_plan.py index 0b83b685..3b0a19b6 100644 --- a/sf_demand_plan/models/sf_production_demand_plan.py +++ b/sf_demand_plan/models/sf_production_demand_plan.py @@ -14,7 +14,6 @@ class SfProductionDemandPlan(models.Model): def _get_machining_precision(self): machinings = self.env['sf.machining.accuracy'].sudo().search([]) - list = [(m.sync_id, m.name) for m in machinings] return list @@ -35,7 +34,8 @@ class SfProductionDemandPlan(models.Model): sale_order_id = fields.Many2one(comodel_name="sale.order", string="销售订单", readonly=True) sale_order_line_id = fields.Many2one(comodel_name="sale.order.line", - string="销售订单行", readonly=True) + string="销售订单明细", readonly=True) + sale_order_line_number = fields.Char(string='销售订单行', compute='_compute_sale_order_line_number', store=True) company_id = fields.Many2one( related='sale_order_id.company_id', store=True, index=True, precompute=True) @@ -167,6 +167,14 @@ class SfProductionDemandPlan(models.Model): if sale_order_state == 'cancel' or not record.sale_order_line_id: record.status = '100' # 取消 + @api.depends('sale_order_line_id.product_id.name') + def _compute_sale_order_line_number(self): + for line in self: + if line.product_id: + line.sale_order_line_number = line.sale_order_line_id.product_id.name[-1] + else: + line.sale_order_line_number = None + @api.depends('product_id.part_number', 'product_id.model_name') def _compute_part_number(self): for line in self: @@ -191,7 +199,7 @@ class SfProductionDemandPlan(models.Model): def _compute_materials_id(self): for line in self: if line.product_id: - line.materials_id = f"{line.product_id.materials_id.name}*{line.product_id.materials_type_id.name}" + line.materials_id = f"{line.product_id.materials_id.name}/{line.product_id.materials_type_id.name}" else: line.materials_id = None diff --git a/sf_demand_plan/views/demand_plan.xml b/sf_demand_plan/views/demand_plan.xml index e68a46f6..251fae8d 100644 --- a/sf_demand_plan/views/demand_plan.xml +++ b/sf_demand_plan/views/demand_plan.xml @@ -3,7 +3,7 @@ sf.production.demand.plan.tree sf.production.demand.plan -