1、删除功能刀具列表模型的刀具名称计算方法,改为创建记录时给数据;2、功能刀具组装单弹窗添加根据旧刀具名称自动选择新刀具的名称;优化没有序列号的刀具物料的库存位移方法,并在刀具物料出库同时货位物料数减一;关闭弹窗创建刀具组、功能刀具名称记录功能;
This commit is contained in:
@@ -11,27 +11,11 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
_description = '功能刀具列表'
|
_description = '功能刀具列表'
|
||||||
|
|
||||||
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具组装单', readonly=True)
|
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具组装单', readonly=True)
|
||||||
|
|
||||||
@api.depends('functional_tool_name_id')
|
|
||||||
def _compute_name(self):
|
|
||||||
for item in self:
|
|
||||||
if item.functional_tool_name_id:
|
|
||||||
name = item.functional_tool_name_id.after_assembly_functional_tool_name
|
|
||||||
inventory = self.env['sf.tool.inventory'].sudo().search([('name', '=', name)])
|
|
||||||
item.name = name
|
|
||||||
if inventory:
|
|
||||||
item.tool_name_id = inventory.id
|
|
||||||
else:
|
|
||||||
item.tool_name_id = False
|
|
||||||
else:
|
|
||||||
item.name = ''
|
|
||||||
item.tool_name_id = False
|
|
||||||
|
|
||||||
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
|
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
|
||||||
code = fields.Char('编码')
|
code = fields.Char('编码')
|
||||||
rfid = fields.Char('Rfid', readonly=True)
|
rfid = fields.Char('Rfid', readonly=True)
|
||||||
name = fields.Char('名称', compute='_compute_name', stroe=True)
|
name = fields.Char('名称')
|
||||||
tool_name_id = fields.Many2one('sf.tool.inventory', '功能刀具名称', compute='_compute_name', store=True)
|
tool_name_id = fields.Many2one('sf.tool.inventory', '功能刀具名称')
|
||||||
sf_cutting_tool_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具型号')
|
sf_cutting_tool_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具型号')
|
||||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', readonly=True)
|
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', readonly=True)
|
||||||
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型',
|
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型',
|
||||||
@@ -302,7 +286,7 @@ class StockMoveLine(models.Model):
|
|||||||
_description = '功能刀具出入库记录'
|
_description = '功能刀具出入库记录'
|
||||||
_order = 'date desc'
|
_order = 'date desc'
|
||||||
|
|
||||||
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称')
|
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具组装单')
|
||||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', store=True,
|
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', store=True,
|
||||||
group_expand='_read_group_functional_tool_type_id')
|
group_expand='_read_group_functional_tool_type_id')
|
||||||
functional_tool_name = fields.Char('刀具名称')
|
functional_tool_name = fields.Char('刀具名称')
|
||||||
|
|||||||
@@ -397,7 +397,7 @@
|
|||||||
<field name="sf_functional_cutting_tool_entity_ids" widget="many2many">
|
<field name="sf_functional_cutting_tool_entity_ids" widget="many2many">
|
||||||
<tree edit="0" create="0" delete="0">
|
<tree edit="0" create="0" delete="0">
|
||||||
<field name="rfid"/>
|
<field name="rfid"/>
|
||||||
<field name="functional_tool_name_id"/>
|
<field name="tool_name_id"/>
|
||||||
<field name="new_former"/>
|
<field name="new_former"/>
|
||||||
<field name="tool_loading_length" string="总长度(mm)"/>
|
<field name="tool_loading_length" string="总长度(mm)"/>
|
||||||
<field name="functional_tool_length"/>
|
<field name="functional_tool_length"/>
|
||||||
@@ -458,7 +458,8 @@
|
|||||||
<field name="reference" string="单据号"/>
|
<field name="reference" string="单据号"/>
|
||||||
<field name="lot_id" invisible="1"/>
|
<field name="lot_id" invisible="1"/>
|
||||||
<field name="rfid"/>
|
<field name="rfid"/>
|
||||||
<field name="functional_tool_name_id" string="功能刀具名称"/>
|
<field name="functional_tool_name_id" optional="hide"/>
|
||||||
|
<field name="functional_tool_name" string="功能刀具名称"/>
|
||||||
<field name="diameter"/>
|
<field name="diameter"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
<field name="install_tool_time"/>
|
<field name="install_tool_time"/>
|
||||||
@@ -481,7 +482,7 @@
|
|||||||
<field name="reference"/>
|
<field name="reference"/>
|
||||||
<field name="lot_id"/>
|
<field name="lot_id"/>
|
||||||
<field name="rfid"/>
|
<field name="rfid"/>
|
||||||
<field name="functional_tool_name_id"/>
|
<field name="functional_tool_name"/>
|
||||||
<field name="diameter"/>
|
<field name="diameter"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
<field name="install_tool_time"/>
|
<field name="install_tool_time"/>
|
||||||
|
|||||||
@@ -221,6 +221,14 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
|
|
||||||
image = fields.Binary('图片')
|
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('整体式刀具货位')
|
integral_freight_barcode = fields.Char('整体式刀具货位')
|
||||||
@@ -461,7 +469,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
obj.tool_code = str_2
|
obj.tool_code = str_2
|
||||||
|
|
||||||
def _get_code(self, 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)],
|
[('code', 'like', str_2)],
|
||||||
limit=1,
|
limit=1,
|
||||||
order="id desc"
|
order="id desc"
|
||||||
@@ -548,15 +556,15 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
if self.handle_code_id:
|
if self.handle_code_id:
|
||||||
product_id.tool_material_stock_moves(self.handle_code_id)
|
product_id.tool_material_stock_moves(self.handle_code_id)
|
||||||
if self.integral_product_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:
|
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:
|
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:
|
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:
|
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 {
|
return {
|
||||||
'barcode_id': stock_lot.id,
|
'barcode_id': stock_lot.id,
|
||||||
'code': self.tool_code,
|
'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,
|
'rfid': self.rfid,
|
||||||
'tool_groups_id': self.after_tool_groups_id.id,
|
'tool_groups_id': self.after_tool_groups_id.id,
|
||||||
'functional_tool_name_id': functional_tool_assembly_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)
|
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({
|
stock_move_id = self.env['stock.move'].sudo().create({
|
||||||
'name': '功能刀具组装',
|
'name': '功能刀具组装',
|
||||||
@@ -795,15 +804,19 @@ class ProductProduct(models.Model):
|
|||||||
'state': 'done'
|
'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({
|
stock_move_line_id = self.env['stock.move.line'].sudo().create({
|
||||||
'product_id': self.id,
|
'product_id': self.id,
|
||||||
'lot_id': self.id,
|
|
||||||
'move_id': stock_move_id.id,
|
'move_id': stock_move_id.id,
|
||||||
|
'current_location_id': location.id,
|
||||||
'install_tool_time': fields.Datetime.now(),
|
'install_tool_time': fields.Datetime.now(),
|
||||||
'qty_done': 1.0,
|
'qty_done': 1.0,
|
||||||
'state': 'done',
|
'state': 'done',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
location.product_num = location.product_num - 1
|
||||||
|
|
||||||
return stock_move_id, stock_move_line_id
|
return stock_move_id, stock_move_line_id
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -288,7 +288,7 @@
|
|||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group col="1"
|
<group col="1"
|
||||||
attrs="{'invisible': ['|',('bar_freight_barcode', '!=', False),('bar_freight_barcode', '!=', False)]}">
|
attrs="{'invisible': ['|',('integral_freight_barcode', '!=', False),('bar_freight_barcode', '!=', False)]}">
|
||||||
<div>
|
<div>
|
||||||
<separator string="刀盘:" style="font-size: 13px;"/>
|
<separator string="刀盘:" style="font-size: 13px;"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -336,11 +336,13 @@
|
|||||||
<field name="barcode_id" invisible="True"/>
|
<field name="barcode_id" invisible="True"/>
|
||||||
<field name="tool_code" readonly="True"/>
|
<field name="tool_code" readonly="True"/>
|
||||||
<field name="rfid" class="custom_required"/>
|
<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_name" string="功能刀具名称" invisible="1"/>
|
||||||
<field name="after_assembly_functional_tool_type_id" string="功能刀具类型"
|
<field name="after_assembly_functional_tool_type_id" string="功能刀具类型"
|
||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
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)"
|
<field name="after_assembly_functional_tool_diameter" string="刀具直径(mm)"
|
||||||
class="custom_required"/>
|
class="custom_required"/>
|
||||||
<field name="after_assembly_knife_tip_r_angle" string="刀尖R角(mm)"
|
<field name="after_assembly_knife_tip_r_angle" string="刀尖R角(mm)"
|
||||||
|
|||||||
Reference in New Issue
Block a user