1、新增功能刀具出入库
This commit is contained in:
@@ -30,7 +30,7 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
||||
tool_loading_length = fields.Float(string='总长度(mm)', readonly=True, digits=(10, 3))
|
||||
handle_length = fields.Float(string='刀柄长度(mm)',readonly=True, digits=(10, 3))
|
||||
handle_length = fields.Float(string='刀柄长度(mm)', readonly=True, digits=(10, 3))
|
||||
functional_tool_length = fields.Float(string='伸出长(mm)', readonly=True, digits=(10, 3))
|
||||
effective_length = fields.Float(string='有效长(mm)', readonly=True)
|
||||
tool_room_num = fields.Integer(string='刀具房数量', readonly=True)
|
||||
@@ -75,6 +75,48 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
record.line_edge_knife_library_num = 0
|
||||
record.machine_knife_library_num = 0
|
||||
|
||||
def tool_in_out_stock_location(self, location_id):
|
||||
for item in self:
|
||||
if item:
|
||||
pass
|
||||
else:
|
||||
if location_id.product_sn_id:
|
||||
tool = self.env['sf.functional.cutting.tool.entity'].search(
|
||||
['barcode_id', '=', location_id.product_sn_id.id])
|
||||
if tool.current_location == '线边刀库':
|
||||
pass
|
||||
|
||||
def create_stock_move(self):
|
||||
# 创建库存移动记录
|
||||
stock_move_id = self.env['stock.move'].sudo().create({
|
||||
'name': name,
|
||||
'product_id': self.barcode_id.product_id.id,
|
||||
'location_id': location_inventory_id.id,
|
||||
'location_dest_id': stock_location_id.id,
|
||||
'product_uom_qty': 1.00,
|
||||
'state': 'done'
|
||||
})
|
||||
|
||||
# 创建移动历史记录
|
||||
stock_move_line_id = self.env['stock.move.line'].sudo().create({
|
||||
'product_id': self.barcode_id.product_id.id,
|
||||
'functional_tool_name_id': functional_tool_assembly_id,
|
||||
'lot_id': self.id,
|
||||
'move_id': stock_move_id.id,
|
||||
'install_tool_time': fields.Datetime.now(),
|
||||
'qty_done': 1.0,
|
||||
'state': 'done',
|
||||
'functional_tool_type_id': False if not obj else obj.functional_tool_type_id.id,
|
||||
'diameter': None if not obj else obj.after_assembly_functional_tool_diameter,
|
||||
'knife_tip_r_angle': None if not obj else obj.after_assembly_knife_tip_r_angle,
|
||||
'code': '' if not obj else obj.code,
|
||||
'rfid': '' if not obj else obj.rfid,
|
||||
'functional_tool_name': '' if not obj else obj.after_assembly_functional_tool_name,
|
||||
'tool_groups_id': False if not tool_groups_id else tool_groups_id.id
|
||||
})
|
||||
return stock_move_id, stock_move_line_id
|
||||
|
||||
|
||||
def get_location_num(self):
|
||||
"""
|
||||
计算库存位置数量
|
||||
|
||||
Reference in New Issue
Block a user