完成刀具组装单扫描绑定刀具物料的功能
This commit is contained in:
@@ -118,6 +118,7 @@ class ToolTransferRequestInformation(models.TransientModel):
|
||||
|
||||
class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
_name = 'sf.functional.tool.assembly.order'
|
||||
_inherit = ["barcodes.barcode_events_mixin"]
|
||||
_description = '功能刀具组装单'
|
||||
|
||||
# 功能刀具申请信息
|
||||
@@ -175,9 +176,34 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号',
|
||||
domain=[('product_id.cutting_tool_material_id.name', '=', '夹头')])
|
||||
cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting.tool.material', string='夹头型号', readonly=True)
|
||||
chuck_name = fields.Char('夹头名称', readonly=True)
|
||||
chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill')
|
||||
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True)
|
||||
|
||||
def on_barcode_scanned(self, barcode):
|
||||
"""
|
||||
智能工厂组装单处扫码绑定刀具物料')
|
||||
"""
|
||||
for record in self:
|
||||
records = record.env['stock.lot'].search([('name', '=', barcode)])
|
||||
if not records:
|
||||
raise ValidationError('扫描的条形码数据不存在,请重新扫描!')
|
||||
for record_stock_lot in records:
|
||||
tool_material_name = record_stock_lot.product_id.cutting_tool_material_id.name
|
||||
if tool_material_name == '整体式刀具':
|
||||
record.integral_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀片':
|
||||
record.blade_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀杆':
|
||||
record.bar_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀盘':
|
||||
record.pad_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀柄':
|
||||
record.handle_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '夹头':
|
||||
record.chuck_code_id = record_stock_lot.id
|
||||
else:
|
||||
raise ValidationError('扫描的刀具物料不存在,请重新扫描!')
|
||||
|
||||
@api.depends('integral_code_id', 'blade_code_id', 'bar_code_id', 'pad_code_id', 'handle_code_id', 'chuck_code_id')
|
||||
def _compute_auto_fill(self):
|
||||
for record in self:
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
</group>
|
||||
</group>
|
||||
<group string="组装物料信息" col="1">
|
||||
<field name="_barcode_scanned" widget="barcode_handler"/>
|
||||
<group col="1" attrs="{'invisible': ['|','|',('blade_code_id', '!=', False),('bar_code_id', '!=', False),('pad_code_id', '!=', False)]}">
|
||||
<div>
|
||||
<separator string="整体式刀具:" style="font-size: 13px;"/>
|
||||
|
||||
Reference in New Issue
Block a user