From 2035dd6857189791ec8d02ab5fe3a94baf027315 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Wed, 26 Feb 2025 12:42:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E5=89=B2=E5=B7=A5=E5=8D=95=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E7=BC=96=E7=A8=8B=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 6 +++--- sf_manufacturing/views/mrp_production_addional_change.xml | 8 ++++---- sf_manufacturing/wizard/sale_order_cancel.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index c4623d65..8b629440 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -270,10 +270,10 @@ class MrpProduction(models.Model): ('成品', '成品'), ('坯料', '坯料'), ('其他', '其他') - ], string='产品类型', default='成品') + ], string='产品类型', compute='_compute_production_product_type') - @api.onchange('product_id') - def onchange_product_id(self): + @api.depends('product_id') + def _compute_production_product_type(self): for record in self: if record.product_id.categ_id.name == '成品': record.production_product_type = '成品' diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 06c2a7bd..020c2691 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -118,11 +118,11 @@ + attrs="{'invisible': ['|', ('production_type', 'not in', ['自动化产线加工', '人工线下加工']), ('production_product_type', '!=', '成品')]}"/> + attrs="{'invisible': ['|', ('production_type', 'not in', ['自动化产线加工', '人工线下加工']), ('production_product_type', '!=', '成品')]}"/> @@ -417,7 +417,7 @@ 子MO - + diff --git a/sf_manufacturing/wizard/sale_order_cancel.py b/sf_manufacturing/wizard/sale_order_cancel.py index e2549911..0799c805 100644 --- a/sf_manufacturing/wizard/sale_order_cancel.py +++ b/sf_manufacturing/wizard/sale_order_cancel.py @@ -317,7 +317,7 @@ class SFSaleOrderCancelLine(models.TransientModel): 'sequence': sequence, 'category': '制造', 'doc_name': '工单', - 'doc_number': f'{mo.name}-{workorder.name}', + 'doc_number': f'{mo.name}-{workorder.processing_panel}-{workorder.name}' if workorder.processing_panel else f'{mo.name}-{workorder.name}', 'line_number': g, 'operation_type': '', 'product_name': f'[{mo.product_id.default_code}] {mo.product_id.name}',