From 347019d7ee7f7c15a2a5fc19a63fa5ef5454d8b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Mon, 16 Jun 2025 09:20:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=A7=E5=93=81=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E7=94=9F=E6=88=90=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/product_template.py | 6 +++--- sf_manufacturing/models/sale_order.py | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/jikimo_test_generate_product_name/models/product_template.py b/jikimo_test_generate_product_name/models/product_template.py index 3aa48be6..85c64726 100644 --- a/jikimo_test_generate_product_name/models/product_template.py +++ b/jikimo_test_generate_product_name/models/product_template.py @@ -12,10 +12,10 @@ class ProductTemplate(models.Model): def generate_embryo_name(self, order_id, item, materials_id, materials_type_id, embryo_redundancy_id, i): """生成坯料名称""" - embryo_name = '%s-%s-%s [%s %s-%s * %s * %s]' % ('R', - order_id.name, i, materials_id.name, materials_type_id.name, + embryo_name = '%s-%s[%s * %s * %s]%s' % (materials_id.name, materials_type_id.name, self.format_float(item['model_long'] + embryo_redundancy_id.long), self.format_float(item['model_width'] + embryo_redundancy_id.width), - self.format_float(item['model_height'] + embryo_redundancy_id.height)) + self.format_float(item['model_height'] + embryo_redundancy_id.height), + item['model_id']) return embryo_name \ No newline at end of file diff --git a/sf_manufacturing/models/sale_order.py b/sf_manufacturing/models/sale_order.py index 04933064..0bb660ac 100644 --- a/sf_manufacturing/models/sale_order.py +++ b/sf_manufacturing/models/sale_order.py @@ -74,14 +74,17 @@ class SaleOrder(models.Model): 'blank_area': product.model_area, 'price': product.list_price, 'embryo_redundancy_id': line.embryo_redundancy_id, + 'model_id': line.model_id } product_name = '' match = re.search(r'(S\d{5}-\d+)', product.name) + product_seria = 0 # 如果匹配成功,提取结果 if match: product_name = match.group(0) - # 获取成品名结尾-n的n - product_seria = int(product_name.split('-')[-1]) + # 获取成品名结尾-n的n + product_seria = int(product_name.split('-')[-1]) + # 成品供货方式为采购则不生成bom if line.supply_method != 'purchase': bom_data = self.env['mrp.bom'].with_user(self.env.ref("base.user_admin")).get_bom(product)