1、删除功能刀具列表模型的刀具名称计算方法,改为创建记录时给数据;2、功能刀具组装单弹窗添加根据旧刀具名称自动选择新刀具的名称;优化没有序列号的刀具物料的库存位移方法,并在刀具物料出库同时货位物料数减一;关闭弹窗创建刀具组、功能刀具名称记录功能;
This commit is contained in:
@@ -221,6 +221,14 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
|
||||
image = fields.Binary('图片')
|
||||
|
||||
@api.onchange('functional_tool_name')
|
||||
def _onchange_functional_tool_name(self):
|
||||
for item in self:
|
||||
if item.functional_tool_name:
|
||||
inventory = self.env['sf.tool.inventory'].sudo().search([('name', '=', item.functional_tool_name)])
|
||||
if inventory:
|
||||
item.after_name_id = inventory.id
|
||||
|
||||
# 功能刀具组装信息
|
||||
# ===============整体式刀具型号=================
|
||||
integral_freight_barcode = fields.Char('整体式刀具货位')
|
||||
@@ -461,7 +469,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
obj.tool_code = str_2
|
||||
|
||||
def _get_code(self, str_2):
|
||||
functional_tool_assembly = self.env['sf.functional.tool.assembly'].sudo().search(
|
||||
functional_tool_assembly = self.env['sf.functional.cutting.tool.entity'].sudo().search(
|
||||
[('code', 'like', str_2)],
|
||||
limit=1,
|
||||
order="id desc"
|
||||
@@ -548,15 +556,15 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
if self.handle_code_id:
|
||||
product_id.tool_material_stock_moves(self.handle_code_id)
|
||||
if self.integral_product_id:
|
||||
self.integral_product_id.material_stock_moves()
|
||||
self.integral_product_id.material_stock_moves(self.integral_freight_barcode)
|
||||
if self.blade_product_id:
|
||||
self.blade_product_id.material_stock_moves()
|
||||
self.blade_product_id.material_stock_moves(self.blade_freight_barcode)
|
||||
if self.bar_product_id:
|
||||
self.bar_product_id.material_stock_moves()
|
||||
self.bar_product_id.material_stock_moves(self.bar_freight_barcode)
|
||||
if self.pad_product_id:
|
||||
self.pad_product_id.material_stock_moves()
|
||||
self.pad_product_id.material_stock_moves(self.pad_freight_barcode)
|
||||
if self.chuck_product_id:
|
||||
self.chuck_product_id.material_stock_moves()
|
||||
self.chuck_product_id.material_stock_moves(self.chuck_freight_barcode)
|
||||
|
||||
# ============================创建功能刀具列表、安全库存记录===============================
|
||||
# 封装功能刀具数据
|
||||
@@ -643,7 +651,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
return {
|
||||
'barcode_id': stock_lot.id,
|
||||
'code': self.tool_code,
|
||||
'name': self.after_assembly_functional_tool_name,
|
||||
'name': self.after_name_id.name,
|
||||
'tool_name_id': self.after_name_id.id,
|
||||
'rfid': self.rfid,
|
||||
'tool_groups_id': self.after_tool_groups_id.id,
|
||||
'functional_tool_name_id': functional_tool_assembly_id.id,
|
||||
@@ -784,7 +793,7 @@ class ProductProduct(models.Model):
|
||||
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
||||
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, '功能刀具组装', False)
|
||||
|
||||
def material_stock_moves(self):
|
||||
def material_stock_moves(self, shelf_location_barcode):
|
||||
# 创建库存移动记录
|
||||
stock_move_id = self.env['stock.move'].sudo().create({
|
||||
'name': '功能刀具组装',
|
||||
@@ -795,15 +804,19 @@ class ProductProduct(models.Model):
|
||||
'state': 'done'
|
||||
})
|
||||
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', shelf_location_barcode)])
|
||||
# 创建移动历史记录
|
||||
stock_move_line_id = self.env['stock.move.line'].sudo().create({
|
||||
'product_id': self.id,
|
||||
'lot_id': self.id,
|
||||
'move_id': stock_move_id.id,
|
||||
'current_location_id': location.id,
|
||||
'install_tool_time': fields.Datetime.now(),
|
||||
'qty_done': 1.0,
|
||||
'state': 'done',
|
||||
})
|
||||
|
||||
location.product_num = location.product_num - 1
|
||||
|
||||
return stock_move_id, stock_move_line_id
|
||||
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@
|
||||
</group>
|
||||
</group>
|
||||
<group col="1"
|
||||
attrs="{'invisible': ['|',('bar_freight_barcode', '!=', False),('bar_freight_barcode', '!=', False)]}">
|
||||
attrs="{'invisible': ['|',('integral_freight_barcode', '!=', False),('bar_freight_barcode', '!=', False)]}">
|
||||
<div>
|
||||
<separator string="刀盘:" style="font-size: 13px;"/>
|
||||
</div>
|
||||
@@ -336,11 +336,13 @@
|
||||
<field name="barcode_id" invisible="True"/>
|
||||
<field name="tool_code" readonly="True"/>
|
||||
<field name="rfid" class="custom_required"/>
|
||||
<field name="after_name_id" string="功能刀具名称" placeholder="请选择功能刀具名称"/>
|
||||
<field name="after_name_id" string="功能刀具名称" placeholder="请选择功能刀具名称"
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="after_assembly_functional_tool_name" string="功能刀具名称" invisible="1"/>
|
||||
<field name="after_assembly_functional_tool_type_id" string="功能刀具类型"
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="after_tool_groups_id"/>
|
||||
<field name="after_tool_groups_id"
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="after_assembly_functional_tool_diameter" string="刀具直径(mm)"
|
||||
class="custom_required"/>
|
||||
<field name="after_assembly_knife_tip_r_angle" string="刀尖R角(mm)"
|
||||
|
||||
Reference in New Issue
Block a user