1、新增功能刀具列表模型自动计算功能刀具在刀具房数量功能;2、优化功能刀具安全库存模型相同功能刀具的检索条件;3、修改功能刀具组装单组装的初始位置为Production,修改功能刀具序列号的生成规则

This commit is contained in:
yuxianghui
2023-11-27 17:27:55 +08:00
parent 030ef14633
commit 5926d71d27
6 changed files with 9 additions and 41 deletions

View File

@@ -438,45 +438,13 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
return stock_lot
# def tool_material_out_of_store(self, tool_material_serial_id):
# """
# 刀具物料出库
# """
# # 获取位置
# location_id = self.env['stock.location'].search([('name', '=', 'Stock')])
# location_dest_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
# print("已运行2222")
# # 创建库存移动
# stock_move_id = self.env['stock.move'].create({
# 'name': '刀具物料出库',
# 'lot_id': tool_material_serial_id.id,
# 'product_id': tool_material_serial_id.product_id.id,
# 'location_id': location_id.id,
# 'location_dest_id': location_dest_id.id,
# 'product_uom_qty': 1.00,
# 'state': 'done'
# })
# print("已运行3333")
# print(stock_move_id)
# # 创建移动历史
# stock_move_line_id = self.env['stock.move.line'].create({
# 'product_id': tool_material_serial_id.product_id.id,
# 'lot_id': tool_material_serial_id.id,
# 'move_id': stock_move_id.id,
# 'install_tool_time': fields.Datetime.now(),
# 'qty_done': 1.0,
# 'state': 'done'
# })
#
# return stock_move_id, stock_move_line_id
def create_stock_quant(self, product_id, stock_lot, functional_tool_assembly):
"""
创建功能刀具该批次/序列号 库存移动和移动历史
"""
# 获取位置对象
stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
location_inventory_id = self.env['stock.location'].search([('name', '=', 'Inventory adjustment')])
location_inventory_id = self.env['stock.location'].search([('name', '=', 'Production')])
# 创建库存移动
stock_move_id = self.env['stock.move'].create({
@@ -504,7 +472,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
"""
生成功能刀具序列号
"""
code = 'JKM-T-' + str(self.functional_tool_type_id.code) + '-' + str(self.functional_tool_diameter) + '-'
code = 'JKM-T-' + str(self.functional_tool_type_id.code) + '-' + str(
self.after_assembly_functional_tool_diameter) + '-'
new_time = fields.Date.today()
code += str(new_time) + '-'
stock_lot_id = self.env['stock.lot'].sudo().search(