1、解决 刀具组装选择的批次号队友物料只剩下1个时-组装完该单据详情不显示批次信息 的bug;2、调整拆解单界面布局

This commit is contained in:
yuxianghui
2024-06-12 16:28:42 +08:00
parent 07c7ed6dba
commit 0ad7e72b15
3 changed files with 38 additions and 50 deletions

View File

@@ -427,11 +427,11 @@ class FunctionalToolAssembly(models.Model):
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌',
related='integral_product_id.brand_id')
@api.depends('integral_freight_barcode_id')
@api.depends('integral_lot_id')
def _compute_integral_product_id(self):
for item in self:
if item.integral_freight_barcode_id:
item.integral_product_id = item.integral_freight_barcode_id.product_id.id
if item.integral_lot_id:
item.integral_product_id = item.integral_lot_id.product_id.id
# =================刀片型号=============
blade_freight_barcode_id = fields.Many2one('sf.shelf.location', string='刀片货位')
@@ -444,11 +444,11 @@ class FunctionalToolAssembly(models.Model):
related='blade_product_id.specification_id')
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', related='blade_product_id.brand_id')
@api.depends('blade_freight_barcode_id')
@api.depends('blade_lot_id')
def _compute_blade_product_id(self):
for item in self:
if item.blade_freight_barcode_id:
item.blade_product_id = item.blade_freight_barcode_id.product_id.id
if item.blade_lot_id:
item.blade_product_id = item.blade_lot_id.product_id.id
# ==============刀杆型号================
bar_freight_barcode_id = fields.Many2one('sf.shelf.location', string='刀杆货位')
@@ -461,11 +461,11 @@ class FunctionalToolAssembly(models.Model):
related='bar_product_id.specification_id')
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', related='bar_product_id.brand_id')
@api.depends('bar_freight_barcode_id')
@api.depends('bar_lot_id')
def _compute_bar_product_id(self):
for item in self:
if item.bar_freight_barcode_id:
item.bar_product_id = item.bar_freight_barcode_id.product_id.id
if item.bar_lot_id:
item.bar_product_id = item.bar_lot_id.product_id.id
# =============刀盘型号================
pad_freight_barcode_id = fields.Many2one('sf.shelf.location', string='刀盘货位')
@@ -478,11 +478,11 @@ class FunctionalToolAssembly(models.Model):
related='pad_product_id.specification_id')
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', related='pad_product_id.brand_id')
@api.depends('pad_freight_barcode_id')
@api.depends('pad_lot_id')
def _compute_pad_product_id(self):
for item in self:
if item.pad_freight_barcode_id:
item.pad_product_id = item.pad_freight_barcode_id.product_id.id
if item.pad_lot_id:
item.pad_product_id = item.pad_lot_id.product_id.id
# ==============刀柄型号==============
handle_freight_rfid = fields.Char('刀柄Rfid', compute='_compute_handle_product_id', store=True)
@@ -516,11 +516,11 @@ class FunctionalToolAssembly(models.Model):
related='chuck_product_id.specification_id')
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', related='chuck_product_id.brand_id')
@api.depends('chuck_freight_barcode_id')
@api.depends('chuck_lot_id')
def _compute_chuck_product_id(self):
for item in self:
if item.chuck_freight_barcode_id:
item.chuck_product_id = item.chuck_freight_barcode_id.product_id.id
if item.chuck_lot_id:
item.chuck_product_id = item.chuck_lot_id.product_id.id
# ==================待删除字段==================
integral_freight_barcode = fields.Char('整体式刀具货位')

View File

@@ -804,90 +804,78 @@
<group>
<group string="刀柄" attrs="{'invisible': [('handle_product_id', '=', False)]}">
<group>
<field name="scrap_boolean" string="是否报废"
attrs="{'invisible': [('dismantle_cause', 'not in', ['寿命到期报废','崩刀报废'])], 'readonly': [('state', '=', '已拆解')]}"/>
<field name="handle_rfid" string="Rfid"/>
<field name="handle_lot_id" string="序列号"/>
<field name="handle_product_id" string="名称"/>
<field name="handle_type_id" string="型号"/>
<field name="handle_brand_id" string="品牌"/>
</group>
<group>
<field name="handle_rfid" string="Rfid"/>
<field name="handle_lot_id" string="序列号"/>
<field name="scrap_boolean" string="是否报废"
attrs="{'invisible': [('dismantle_cause', 'not in', ['寿命到期报废','崩刀报废'])], 'readonly': [('state', '=', '已拆解')]}"/>
</group>
</group>
<group string="夹头"
attrs="{'invisible': [('chuck_product_id', '=', False)]}">
<group>
<field name="chuck_product_id" string="名称"/>
<field name="chuck_type_id" string="型号"/>
<field name="chuck_brand_id" string="品牌"/>
</group>
<group>
<field name="chuck_freight_id" string="目标货位" placeholder="请选择"
options="{'no_create': True,'no_create_edit':True}"
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具', '刀具需磨削'])], 'readonly': [('state', '=', '已拆解')],
'required': [('chuck_lot_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
<field name="chuck_lot_id" string="批次"/>
<field name="chuck_product_id" string="名称"/>
<field name="chuck_type_id" string="型号"/>
<field name="chuck_brand_id" string="品牌"/>
</group>
</group>
</group>
<group attrs="{'invisible': [('integral_product_id', '=', False)]}">
<group string="整体式刀具">
<group>
<field name="integral_product_id" string="名称"/>
<field name="integral_type_id" string="型号"/>
<field name="integral_brand_id" string="品牌"/>
</group>
<group>
<field name="integral_freight_id" string="目标货位" placeholder="请选择"
options="{'no_create': True,'no_create_edit':True}"
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具', '刀具需磨削'])], 'readonly': [('state', '=', '已拆解')],
'required': [('integral_lot_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
<field name="integral_lot_id" string="批次"/>
<field name="integral_product_id" string="名称"/>
<field name="integral_type_id" string="型号"/>
<field name="integral_brand_id" string="品牌"/>
</group>
</group>
</group>
<group>
<group string="刀片" attrs="{'invisible': [('blade_product_id', '=', False)]}">
<group>
<field name="blade_product_id" string="名称"/>
<field name="blade_type_id" string="型号"/>
<field name="blade_brand_id" string="品牌"/>
</group>
<group>
<field name="blade_freight_id" string="目标货位" placeholder="请选择"
options="{'no_create': True,'no_create_edit':True}"
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具', '刀具需磨削'])], 'readonly': [('state', '=', '已拆解')],
'required': [('blade_lot_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
<field name="blade_lot_id" string="批次"/>
<field name="blade_product_id" string="名称"/>
<field name="blade_type_id" string="型号"/>
<field name="blade_brand_id" string="品牌"/>
</group>
</group>
<group string="刀杆" attrs="{'invisible': [('bar_product_id', '=', False)]}">
<group>
<field name="bar_product_id" string="名称"/>
<field name="bar_type_id" string="型号"/>
<field name="bar_brand_id" string="品牌"/>
</group>
<group>
<field name="bar_freight_id" string="目标货位" placeholder="请选择"
options="{'no_create': True,'no_create_edit':True}"
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具', '刀具需磨削'])], 'readonly': [('state', '=', '已拆解')],
'required': [('bar_lot_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
<field name="bar_lot_id" string="批次"/>
<field name="bar_product_id" string="名称"/>
<field name="bar_type_id" string="型号"/>
<field name="bar_brand_id" string="品牌"/>
</group>
</group>
<group string="刀盘" attrs="{'invisible': [('pad_product_id', '=', False)]}">
<group>
<field name="pad_product_id" string="名称"/>
<field name="pad_type_id" string="型号"/>
<field name="pad_brand_id" string="品牌"/>
</group>
<group>
<field name="pad_freight_id" string="目标货位" placeholder="请选择"
options="{'no_create': True,'no_create_edit':True}"
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具', '刀具需磨削'])], 'readonly': [('state', '=', '已拆解')],
'required': [('pad_lot_id', '!=', False), ('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
<field name="pad_lot_id" string="批次"/>
<field name="pad_product_id" string="名称"/>
<field name="pad_type_id" string="型号"/>
<field name="pad_brand_id" string="品牌"/>
</group>
</group>
</group>

View File

@@ -617,6 +617,10 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 创建组装入库单
# 创建功能刀具批次/序列号记录
stock_lot = product_id.create_assemble_warehouse_receipt(self.id, functional_tool_assembly, self)
# 封装功能刀具数据,用于更新组装单信息
desc_1 = self.get_desc_1(stock_lot)
# 封装功能刀具数据,用于创建功能刀具记录
desc_2 = self.get_desc_2(stock_lot, functional_tool_assembly)
# 创建刀具组装入库单
self.env['stock.picking'].create_stocking_picking(stock_lot, functional_tool_assembly, self)
# 刀具物料出库
@@ -639,8 +643,6 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
self.chuck_freight_lot_id, self.assembly_order_code)
# ============================创建功能刀具列表、安全库存记录===============================
# 封装功能刀具数据
desc_2 = self.get_desc_2(stock_lot, functional_tool_assembly)
# 创建功能刀具列表记录
record_1 = self.env['sf.functional.cutting.tool.entity'].create(desc_2)
# 创建安全库存信息
@@ -649,8 +651,6 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
}, record_1)
# =====================修改功能刀具组装单、机床换刀申请、CAM工单程序用刀计划的状态==============
# 封装功能刀具数据
desc_1 = self.get_desc_1(stock_lot)
# 修改功能刀具组装单信息
functional_tool_assembly.write(desc_1)
if functional_tool_assembly.sf_machine_table_tool_changing_apply_id: