新增功能刀具组装对象取消组装时删除组装时所创建的功能刀具列表信息,删除了功能刀具组装对象组装时创建功能刀具预警、实时分布、出入库记录信息的功能。

This commit is contained in:
yuxianghui
2023-08-03 14:31:16 +08:00
parent 48d673a48e
commit 03cc5b2281
4 changed files with 42 additions and 32 deletions

View File

@@ -591,6 +591,20 @@ class FunctionalToolAssembly(models.Model):
取消功能刀具组装
:return:
"""
if self.new_former == '0':
# 如果是新刀,则删除功能刀具列表、
self.env['sf.functional.cutting.tool.entity'].search([
('code', '=', self.functional_tool_code)]).unlink()
else:
pass
# # 删除功能刀具预警、实时分布、出入库记录的新记录
# self.env['sf.functional.tool.warning'].search([
# ('code', '=', self.functional_tool_code)]).unlink()
# self.env['sf.real.time.distribution.of.functional.tools'].search([
# ('code', '=', self.functional_tool_code)]).unlink()
# self.env['sf.inbound.and.outbound.records.of.functional.tools'].search([
# ('code', '=', self.functional_tool_code)]).unlink()
self.env['sf.functional.tool.assembly'].search([
('machine_tool_name_id', '=', self.machine_tool_name_id.id),
('cutter_spacing_code', '=', self.cutter_spacing_code)
@@ -639,28 +653,20 @@ class FunctionalToolAssembly(models.Model):
"""
self.env['sf.delivery.of.cargo.from.storage'].search([]).unlink()
vals = self.env['sf.functional.tool.assembly'].search([('check_box_1', '=', True),('assemble_status', '=', '1')])
if vals:
for val in vals:
self.env['sf.delivery.of.cargo.from.storage'].create({
'functional_tool_code': val.functional_tool_code,
desc_1 = {'functional_tool_code': val.functional_tool_code,
'name': val.name.id,
'functional_tool_type_id': val.functional_tool_type_id.id,
'production_line_name_id': val.production_line_name_id.id,
'machine_tool_code': val.machine_tool_code,
'receive_person': val.receive_person,
'receive_time': val.receive_time
})
'receive_time': val.receive_time}
vals = self.env['sf.functional.tool.assembly'].search([('check_box_1', '=', True),('assemble_status', '=', '1')])
if vals:
for val in vals:
self.env['sf.delivery.of.cargo.from.storage'].create(desc_1)
else:
self.env['sf.delivery.of.cargo.from.storage'].create({
'functional_tool_code': self.functional_tool_code,
'name': self.name.id,
'functional_tool_type_id': self.functional_tool_type_id.id,
'production_line_name_id': self.production_line_name_id.id,
'machine_tool_code': self.machine_tool_code,
'receive_person': self.receive_person,
'receive_time': self.receive_time
})
self.env['sf.delivery.of.cargo.from.storage'].create(desc_1)
return {
'type': 'ir.actions.act_window',