1、注释action_apply_inventory()方法;2、功能刀具安全库存添加one2many类型的功能刀具废弃many2many类型的关联字段并优化代码,并在功能刀具模型添加功能按钮用来绑定功能刀具和对应的功能刀具安全库存;3、优化根据库存创建功能刀具组装单的方法断定条件;4、优化刀具注册接口的报错处理;5、优化组装流程

This commit is contained in:
yuxianghui
2024-05-18 11:54:23 +08:00
parent 305e91e7f1
commit 9e2091597b
5 changed files with 275 additions and 243 deletions

View File

@@ -607,7 +607,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 对物料做必填判断
self.materials_must_be_judged()
product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
product_id = self.env['product.product']
# 创建组装入库单
# 创建功能刀具批次/序列号记录
stock_lot = product_id.create_assemble_warehouse_receipt(self.id, functional_tool_assembly, self)
@@ -617,15 +617,15 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
if self.handle_code_id:
product_id.tool_material_stock_moves(self.handle_code_id, self.assembly_order_code)
if self.integral_product_id:
self.integral_product_id.material_stock_moves(self.integral_freight_barcode,self.assembly_order_code)
self.integral_product_id.material_stock_moves(self.integral_freight_barcode, self.assembly_order_code)
if self.blade_product_id:
self.blade_product_id.material_stock_moves(self.blade_freight_barcode,self.assembly_order_code)
self.blade_product_id.material_stock_moves(self.blade_freight_barcode, self.assembly_order_code)
if self.bar_product_id:
self.bar_product_id.material_stock_moves(self.bar_freight_barcode,self.assembly_order_code)
self.bar_product_id.material_stock_moves(self.bar_freight_barcode, self.assembly_order_code)
if self.pad_product_id:
self.pad_product_id.material_stock_moves(self.pad_freight_barcode,self.assembly_order_code)
self.pad_product_id.material_stock_moves(self.pad_freight_barcode, self.assembly_order_code)
if self.chuck_product_id:
self.chuck_product_id.material_stock_moves(self.chuck_freight_barcode,self.assembly_order_code)
self.chuck_product_id.material_stock_moves(self.chuck_freight_barcode, self.assembly_order_code)
# ============================创建功能刀具列表、安全库存记录===============================
# 封装功能刀具数据
@@ -803,8 +803,8 @@ class ProductProduct(models.Model):
创建功能刀具批次/序列号记录
"""
product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
logging.info("product_id: %s" % product_id)
if not product_id:
logging.info('没有搜索到功能刀具产品:%s' % product_id)
stock_lot = self.env['stock.lot'].create({
'name': self.get_stock_lot_name(tool_assembly_order_id),
'product_id': product_id.id,
@@ -849,7 +849,8 @@ class ProductProduct(models.Model):
location_inventory_id = tool_material.quant_ids.location_id[-1]
stock_location_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
# 创建功能刀具该批次/序列号 库存移动和移动历史
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, assembly_order_code, False, False)
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, assembly_order_code, False,
False)
def material_stock_moves(self, shelf_location_barcode, assembly_order_code):
# 创建库存移动记录