1、序列号模型添加Rfid字段的重复校验;功能刀具模型优化搜索视图的字段;优功能刀具组装流程的值
This commit is contained in:
@@ -329,7 +329,7 @@ class ToolInventory(models.Model):
|
||||
blade_number = fields.Integer('刃数(个)')
|
||||
extension = fields.Float('伸出长度(mm)')
|
||||
work_material = fields.Selection([('钢', '钢'), ('铝', '铝')], string='加工材料')
|
||||
life_span = fields.Float('寿命(h)')
|
||||
life_span = fields.Float('寿命(min)')
|
||||
|
||||
tool_groups_id = fields.Many2one('sf.tool.groups', string='刀具组')
|
||||
|
||||
|
||||
@@ -425,6 +425,18 @@ class ProductionLot(models.Model):
|
||||
# 'target': 'self',
|
||||
# }
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
if vals.get('rfid'):
|
||||
lots = self.env['stock.lot'].search([('rfid', '=', vals['rfid'])])
|
||||
if lots:
|
||||
for lot in lots:
|
||||
raise ValidationError('Rfid【%s】已被序列号为【%s】的【%s】产品占用!' % (
|
||||
lot.rfid, lot.name, lot.product_id.name))
|
||||
records = super(ProductionLot, self).create(vals_list)
|
||||
return records
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
@@ -184,27 +184,10 @@
|
||||
<field name="model">sf.functional.cutting.tool.entity</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="barcode_id"/>
|
||||
<field name="rfid"/>
|
||||
<field name="functional_tool_name_id"/>
|
||||
<field name="image" widget='image'/>
|
||||
<field name="tool_name_id"/>
|
||||
<field name="functional_tool_diameter"/>
|
||||
<field name="knife_tip_r_angle"/>
|
||||
<field name="coarse_middle_thin" optional="hide"/>
|
||||
<field name="new_former" optional="hide"/>
|
||||
<field name="tool_loading_length" optional="hide"/>
|
||||
<field name="functional_tool_length" optional="hide"/>
|
||||
<field name="effective_length" optional="hide"/>
|
||||
<field name="tool_room_num"/>
|
||||
<field name="line_edge_knife_library_num"/>
|
||||
<field name="machine_knife_library_num"/>
|
||||
<field name="max_lifetime_value"/>
|
||||
<field name="alarm_value"/>
|
||||
<field name="used_value"/>
|
||||
<field name="functional_tool_status" optional="hide"/>
|
||||
|
||||
<field name="current_location_id" invisible="True"/>
|
||||
<field name="sf_cutting_tool_type_id" invisible="True"/>
|
||||
<filter string="未拆除" name="no_state_removed" domain="[('functional_tool_status', '!=', '已拆除')]"/>
|
||||
<filter string="已拆除" name="state_removed" domain="[('functional_tool_status', '=', '已拆除')]"/>
|
||||
<separator/>
|
||||
|
||||
@@ -615,17 +615,17 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
self.env['stock.picking'].create_stocking_picking(stock_lot, functional_tool_assembly, self)
|
||||
# 刀具物料出库
|
||||
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, self.assembly_order_code)
|
||||
if self.integral_product_id:
|
||||
self.integral_product_id.material_stock_moves(self.integral_freight_barcode)
|
||||
self.integral_product_id.material_stock_moves(self.integral_freight_barcode,self.assembly_order_code)
|
||||
if self.blade_product_id:
|
||||
self.blade_product_id.material_stock_moves(self.blade_freight_barcode)
|
||||
self.blade_product_id.material_stock_moves(self.blade_freight_barcode,self.assembly_order_code)
|
||||
if self.bar_product_id:
|
||||
self.bar_product_id.material_stock_moves(self.bar_freight_barcode)
|
||||
self.bar_product_id.material_stock_moves(self.bar_freight_barcode,self.assembly_order_code)
|
||||
if self.pad_product_id:
|
||||
self.pad_product_id.material_stock_moves(self.pad_freight_barcode)
|
||||
self.pad_product_id.material_stock_moves(self.pad_freight_barcode,self.assembly_order_code)
|
||||
if self.chuck_product_id:
|
||||
self.chuck_product_id.material_stock_moves(self.chuck_freight_barcode)
|
||||
self.chuck_product_id.material_stock_moves(self.chuck_freight_barcode,self.assembly_order_code)
|
||||
|
||||
# ============================创建功能刀具列表、安全库存记录===============================
|
||||
# 封装功能刀具数据
|
||||
@@ -820,7 +820,7 @@ class ProductProduct(models.Model):
|
||||
stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
|
||||
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
||||
stock_lot.create_stock_quant(location_inventory_id, stock_location_id, functional_tool_assembly.id,
|
||||
'功能刀具组装', obj, obj.after_tool_groups_id)
|
||||
self.assembly_order_code, obj, obj.after_tool_groups_id)
|
||||
|
||||
return stock_lot
|
||||
|
||||
@@ -846,7 +846,7 @@ class ProductProduct(models.Model):
|
||||
num = "%03d" % m
|
||||
return code + str(num)
|
||||
|
||||
def tool_material_stock_moves(self, tool_material):
|
||||
def tool_material_stock_moves(self, tool_material, assembly_order_code):
|
||||
"""
|
||||
对刀具物料进行库存移动到 刀具组装位置
|
||||
"""
|
||||
@@ -854,12 +854,12 @@ class ProductProduct(models.Model):
|
||||
location_inventory_id = tool_material.quant_ids.location_id[-1]
|
||||
stock_location_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
|
||||
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
||||
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, '功能刀具组装', False, False)
|
||||
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, assembly_order_code, False, False)
|
||||
|
||||
def material_stock_moves(self, shelf_location_barcode):
|
||||
def material_stock_moves(self, shelf_location_barcode, assembly_order_code):
|
||||
# 创建库存移动记录
|
||||
stock_move_id = self.env['stock.move'].sudo().create({
|
||||
'name': '功能刀具组装',
|
||||
'name': assembly_order_code,
|
||||
'product_id': self.id,
|
||||
'location_id': self.env['stock.location'].search([('name', '=', '刀具房')]).id,
|
||||
'location_dest_id': self.env['stock.location'].search([('name', '=', '刀具组装位置')]).id,
|
||||
|
||||
Reference in New Issue
Block a user