From 5b9fcb2e53a30367b4278dd1f470a3089d2e4c2e Mon Sep 17 00:00:00 2001 From: "JIKIMO-YXH\\xianghui" <3437689193@qq.com> Date: Fri, 27 Oct 2023 17:46:19 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=88=9B=E5=BB=BA=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E8=AF=A5=E6=89=B9=E6=AC=A1?= =?UTF-8?q?/=E5=BA=8F=E5=88=97=E5=8F=B7=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_dlm/data/product_data.xml | 5 +++-- sf_manufacturing/data/stock_data.xml | 9 +++++++++ sf_tool_management/wizard/wizard.py | 28 +++++++++++++++++++++++++--- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/sf_dlm/data/product_data.xml b/sf_dlm/data/product_data.xml index 528c6ec2..4474a524 100644 --- a/sf_dlm/data/product_data.xml +++ b/sf_dlm/data/product_data.xml @@ -38,8 +38,9 @@ 功能刀具 - + + + false delivery product false diff --git a/sf_manufacturing/data/stock_data.xml b/sf_manufacturing/data/stock_data.xml index 4e1841e2..b65b2235 100644 --- a/sf_manufacturing/data/stock_data.xml +++ b/sf_manufacturing/data/stock_data.xml @@ -31,6 +31,15 @@ + + + + + + + + + 外协入库 internal diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py index 7218bd1f..a0fd7b95 100644 --- a/sf_tool_management/wizard/wizard.py +++ b/sf_tool_management/wizard/wizard.py @@ -430,12 +430,36 @@ class FunctionalToolAssemblyOrder(models.TransientModel): stock_lot = self.env['stock.lot'].create({ 'name': self.get_stock_lot_name(), 'product_id': product_id.id, - 'product_qty': 1.00, 'company_id': self.env.company.id }) + # 创建功能刀具该批次/序列号位置 + self.create_stock_quant(product_id, stock_lot) return stock_lot + def create_stock_quant(self, product_id, stock_lot): + """ + 创建功能刀具该批次/序列号位置 + """ + # 获取组装后位置对象 + stock_location = self.env['stock.location'].search([('name', '=', '组装后')]) + # + self.env['stock.move'].create({ + '': + }) + + # 创建功能刀具该批次/序列号位置 + # stock_quant = self.env['stock.quant'].create({ + # 'location_id': stock_location.id, + # 'product_id': product_id.id, + # 'lot_id': stock_lot.id, + # 'quantity': 1.0 + # }) + + # # 应用该位置 + # bool = stock_quant.action_apply_inventory() + # return stock_quant + def get_stock_lot_name(self): """ 生成功能刀具序列号 @@ -448,13 +472,11 @@ class FunctionalToolAssemblyOrder(models.TransientModel): limit=1, order="id desc" ) - print(stock_lot_id) if not stock_lot_id: num = "%03d" % 1 else: m = int(stock_lot_id.name[-3:]) + 1 num = "%03d" % m - print(num) return code + str(num)