Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/odoo16翻译研究

This commit is contained in:
mgw
2023-08-02 18:03:41 +08:00
6 changed files with 588 additions and 435 deletions

View File

@@ -123,20 +123,20 @@ class FunctionalToolWarning(models.Model):
image = fields.Binary('图片', readonly=True)
# 功能刀具预警 特有字段
install_tool_time = fields.Char("装刀时间", readonly=True)
outbound_time = fields.Char('出库时间', readonly=True)
on_board_time = fields.Char('上机时间', readonly=True)
machine_tool_code = fields.Char('机台号', readonly=True)
cutting_tool_code = fields.Char('刀位号', readonly=True)
idle_time = fields.Char('闲置时长', readonly=True)
alarm_value = fields.Char('报警值', readonly=True)
used_value = fields.Char('已使用值', readonly=True)
alarm_type = fields.Char('报警类型', readonly=True)
alarm_time = fields.Char('报警时间', readonly=True)
dispose_user = fields.Char('处理人', readonly=True)
dispose_time = fields.Char('处理时间', readonly=True)
dispose_func = fields.Char('处理方法/措施', readonly=True)
remark = fields.Char('备注', readonly=True)
install_tool_time = fields.Char("装刀时间", readonly=False)
outbound_time = fields.Char('出库时间', readonly=False)
on_board_time = fields.Char('上机时间', readonly=False)
machine_tool_code = fields.Char('机台号', readonly=False)
cutting_tool_code = fields.Char('刀位号', readonly=False)
idle_time = fields.Char('闲置时长', readonly=False)
alarm_value = fields.Char('报警值', readonly=False)
used_value = fields.Char('已使用值', readonly=False)
alarm_type = fields.Char('报警类型', readonly=False)
alarm_time = fields.Char('报警时间', readonly=False)
dispose_user = fields.Char('处理人', readonly=False)
dispose_time = fields.Char('处理时间', readonly=False)
dispose_func = fields.Char('处理方法/措施', readonly=False)
remark = fields.Char('备注', readonly=False)
@api.onchange('functional_cutting_tool_id')
def onchange_functional_cutting_tool_id(self):
@@ -197,16 +197,16 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
image = fields.Binary('图片', readonly=True)
# 功能刀具实时分布
tool_stock_num = fields.Char(string='刀具房库存数量', readonly=True)
side_shelf_num = fields.Char(string='线边货架货架数量', readonly=True)
on_tool_stock_num = fields.Char(string='机内刀库库存数量', readonly=True)
tool_stock_total = fields.Char(string='合计', readonly=True)
return_reuse_num_re = fields.Char(string='归还再用数量(精)', readonly=True)
return_reuse_num_co = fields.Char(string='归还再用数量(粗)', readonly=True)
return_processing_num = fields.Char(string='归还需磨削数量', readonly=True)
return_total = fields.Char(string='合计', readonly=True)
total = fields.Char(string='总计', readonly=True)
remark = fields.Char(string='备注/说明', readonly=True)
tool_stock_num = fields.Char(string='刀具房库存数量', readonly=False)
side_shelf_num = fields.Char(string='线边货架货架数量', readonly=False)
on_tool_stock_num = fields.Char(string='机内刀库库存数量', readonly=False)
tool_stock_total = fields.Char(string='合计', readonly=False)
return_reuse_num_re = fields.Char(string='归还再用数量(精)', readonly=False)
return_reuse_num_co = fields.Char(string='归还再用数量(粗)', readonly=False)
return_processing_num = fields.Char(string='归还需磨削数量', readonly=False)
return_total = fields.Char(string='合计', readonly=False)
total = fields.Char(string='总计', readonly=False)
remark = fields.Char(string='备注/说明', readonly=False)
class InboundAndOutboundRecordsOfFunctionalTools(models.Model):
@@ -263,25 +263,25 @@ class InboundAndOutboundRecordsOfFunctionalTools(models.Model):
image = fields.Binary('图片', readonly=True)
# 功能刀具出入库记录 特有字段
thickness = fields.Selection([('1', ''), ('2', ''), ('3', '')], string='粗/中/精', readonly=True)
max_life_span = fields.Char(string='最大寿命值', readonly=True)
alarm_value = fields.Char(string='报警值', readonly=True)
used_value = fields.Char(string='已使用值', readonly=True)
current_state = fields.Char(string='当前状态', readonly=True)
current_store_area = fields.Char(string='当前库区', readonly=True)
current_store_place = fields.Char(string='当前库位', readonly=True)
number = fields.Integer(string='数量', readonly=True)
reason_application = fields.Char(string='申请原因', readonly=True)
applicant = fields.Char(string='申请人', readonly=True)
return_staff = fields.Char(string='归还人', readonly=True)
return_time = fields.Date(string='归还入库时间', readonly=True)
tool_state = fields.Char(string="刀具状态", readonly=True)
tool_install_staff = fields.Char(string='装刀人', readonly=True)
tool_install_time = fields.Datetime(string='装刀时间', readonly=True)
receive_equipment = fields.Char(string='领用机台', readonly=True)
receive_staff = fields.Char(string='领用人', readonly=True)
receive_time = fields.Char(string='领用出库时间', readonly=True)
remark = fields.Text(string='备注/说明', readonly=True)
thickness = fields.Selection([('1', ''), ('2', ''), ('3', '')], string='粗/中/精', readonly=False)
max_life_span = fields.Char(string='最大寿命值', readonly=False)
alarm_value = fields.Char(string='报警值', readonly=False)
used_value = fields.Char(string='已使用值', readonly=False)
current_state = fields.Char(string='当前状态', readonly=False)
current_store_area = fields.Char(string='当前库区', readonly=False)
current_store_place = fields.Char(string='当前库位', readonly=False)
number = fields.Integer(string='数量', readonly=False)
reason_application = fields.Char(string='申请原因', readonly=False)
applicant = fields.Char(string='申请人', readonly=False)
return_staff = fields.Char(string='归还人', readonly=False)
return_time = fields.Date(string='归还入库时间', readonly=False)
tool_state = fields.Char(string="刀具状态", readonly=False)
tool_install_staff = fields.Char(string='装刀人', readonly=False)
tool_install_time = fields.Datetime(string='装刀时间', readonly=False)
receive_equipment = fields.Char(string='领用机台', readonly=False)
receive_staff = fields.Char(string='领用人', readonly=False)
receive_time = fields.Char(string='领用出库时间', readonly=False)
remark = fields.Text(string='备注/说明', readonly=False)
class MachineTableToolChangingApply(models.Model):
@@ -294,37 +294,43 @@ class MachineTableToolChangingApply(models.Model):
# string='换刀需求信息',
# attrs="{'invisible': 1}")
name = fields.Char(string='CNC机床', readonly="True")
# todo 机床类型和刀位号 为 Many2one
machine_table_type = fields.Char(string='机床类型', readonly="True")
name = fields.Many2one('sf.machine_tool', string='CNC机床', readonly=False)
machine_table_type_id = fields.Many2one('sf.machine_tool.category', string='机床类型', readonly=False)
machine_tool_code = fields.Char(string='机台号', attrs="{'invisible': 1}")
cutter_spacing_code = fields.Char(string='刀位号', readonly="True")
functional_tool_code = fields.Char(string='功能刀具编码', readonly="True")
functional_tool_name = fields.Char(string='功能刀具名称', readonly="True")
# todo 功能刀具类型为 Many2one
functional_tool_type = fields.Char(string='功能刀具类型', readonly="True")
diameter = fields.Char(string='直径', readonly="True")
coarse_middle_thin = fields.Selection([("1", ""), ('2', ''), ('3', '')], string='粗/中/精', readonly="True")
hilt_name = fields.Char(string='刀柄名称', readonly="True")
hilt_code = fields.Char(string='刀柄编号', readonly="True")
max_lifetime_value = fields.Char(string='最大寿命', readonly="True")
alarm_value = fields.Char(string='报警', readonly="True")
used_value = fields.Char(string='已使用值', readonly="True")
functional_tool_status = fields.Selection([('正常', '正常'), ('异常', '异常')], string='功能刀具状态', default='正常', readonly="True")
cutter_spacing_code = fields.Char(string='刀位号', readonly=False)
functional_tool_code = fields.Char(string='功能刀具编码', readonly=True, compute='_compute_functional_tool_name_id')
functional_tool_name_id = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=False)
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model',string='功能刀具类型', readonly=True, compute='_compute_functional_tool_name_id')
diameter = fields.Char(string='直径', readonly=False)
coarse_middle_thin = fields.Selection([("1", ""), ('2', ''), ('3', '')], string='粗/中/精', readonly=False)
hilt_name = fields.Char(string='刀柄名称', readonly=False)
hilt_code = fields.Char(string='刀柄编号', readonly=False)
max_lifetime_value = fields.Char(string='最大寿命值', readonly=False)
alarm_value = fields.Char(string='报警', readonly=False)
used_value = fields.Char(string='已使用', readonly=False)
functional_tool_status = fields.Selection([('正常', '正常'), ('异常', '异常')], string='功能刀具状态', default='正常', readonly=False)
replacement_tool_code = fields.Char(string='待换刀具编码', readonly="True")
replacement_tool_name = fields.Char(string='待换刀具名称', readonly="True")
replacement_tool_type = fields.Char(string='待换刀具类型', readonly="True")
replacement_tool_code = fields.Char(string='待换刀具编码', readonly=True)
replacement_tool_name_id = fields.Many2one('sf.functional.cutting.tool', string='待换刀具名称', readonly=True)
replacement_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='待换刀具类型', readonly=True)
replacement_tool_coarse_middle_thin = fields.Selection([("1", ""), ('2', ''), ('3', '')],
string='粗/中/精', readonly="True")
new_former = fields.Selection([('0', ''), ('1', '')], string='新/旧', readonly="True")
applicant = fields.Char(string='申请人', readonly="True")
used_tool_time = fields.Datetime(string='用刀时间', readonly="True")
reason_for_applying = fields.Char(string='申请原因', readonly="True")
remark = fields.Char(string='备注说明', readonly="True")
string='粗/中/精', readonly=True)
new_former = fields.Selection([('0', ''), ('1', '')], string='新/旧', readonly=True)
applicant = fields.Char(string='申请人', readonly=True)
used_tool_time = fields.Datetime(string='用刀时间', readonly=True)
reason_for_applying = fields.Char(string='申请原因', readonly=True)
remark = fields.Char(string='备注说明', readonly=False)
status = fields.Selection([('0', '未操作'), ('1', '已换刀申请'), ('2', '已转移')], string='操作状态', default='0')
@api.depends('functional_tool_name_id')
def _compute_functional_tool_name_id(self):
for record in self:
if record:
record.functional_tool_code = record.functional_tool_name_id.code
record.functional_tool_type_id = record.functional_tool_name_id.mrs_cutting_tool_type_id.id
@api.onchange('functional_tool_status')
def automation_apply_for_tool_change(self):
"""
@@ -335,10 +341,10 @@ class MachineTableToolChangingApply(models.Model):
# todo 自动换刀申请条件需补充完善
if(self.functional_tool_status == '异常'):
self.env['sf.machine.table.tool.changing.apply'].search([
('name', '=', self.name)]).write({
('name', '=', self.name.id)]).write({
'replacement_tool_code': self.functional_tool_code,
'replacement_tool_name': self.functional_tool_name,
'replacement_tool_type': self.functional_tool_type,
'replacement_tool_name_id': self.functional_tool_name_id.id,
'replacement_tool_type_id': self.functional_tool_type_id.id,
'replacement_tool_coarse_middle_thin': self.coarse_middle_thin,
'new_former': '0',
'applicant': '自动申请',
@@ -351,8 +357,8 @@ class MachineTableToolChangingApply(models.Model):
# 新建组装任务
self.env['sf.functional.tool.assembly'].create({
'functional_tool_code': self.functional_tool_code,
'name': self.functional_tool_name,
'functional_tool_type': self.functional_tool_type,
'name': self.functional_tool_name_id,
'functional_tool_type_id': self.functional_tool_type_id.id,
'functional_tool_diameter': self.diameter,
'loading_task_source': '1',
'applicant': '自动申请',
@@ -384,11 +390,16 @@ class MachineTableToolChangingApply(models.Model):
换刀申请撤回按键
:return:
"""
# 撤回功能刀具组装创建的任务
self.env['sf.functional.tool.assembly'].search(
[('functional_tool_code', '=', self.replacement_tool_code),
('loading_task_source', '=', '1')]).unlink()
# 撤回数据更新
self.env['sf.machine.table.tool.changing.apply'].search([('name', '=', self.name)]).write({
self.env['sf.machine.table.tool.changing.apply'].search([('name', '=', self.name.id)]).write({
'replacement_tool_code': None,
'replacement_tool_name': None,
'replacement_tool_type': None,
'replacement_tool_name_id': None,
'replacement_tool_type_id': None,
'replacement_tool_coarse_middle_thin': None,
'new_former': None,
'applicant': None,
@@ -398,10 +409,6 @@ class MachineTableToolChangingApply(models.Model):
'status': '0'
})
# 撤回功能刀具组装创建新任务
self.env['sf.functional.tool.assembly'].search(
[('functional_tool_code', '=', self.functional_tool_code)]).unlink()
def revocation_2(self):
"""
@@ -409,7 +416,7 @@ class MachineTableToolChangingApply(models.Model):
:return:
"""
self.env['sf.machine.table.tool.changing.apply'].search(
[('name', '=', self.name)]).write({
[('name', '=', self.name.id)]).write({
'status': '0'
})
@@ -418,66 +425,72 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
_name = 'sf.cam.work.order.program.knife.plan'
_description = 'CAM工单程序用刀计划'
name = fields.Char(string='工单任务编号', readonly=True)
cam_procedure_code = fields.Char(string='CAM程序编号', readonly=True)
cam_cutter_spacing_code = fields.Char(string='CAM刀位号', readonly=True)
functional_tool_code = fields.Char(string='功能刀具编码', readonly=True)
functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
functional_tool_type = fields.Char(string='功能刀具类型', readonly=True)
machine_table_name = fields.Char(string='机床名称', readonly=True)
machine_tool_cutter_spacing_code = fields.Char(string='机床刀位号', readonly=True)
diameter = fields.Char(string='直径(程式)', readonly=True)
tool_loading_length = fields.Char(string='装刀长', readonly=True)
clearance_length = fields.Char(string='避空长', readonly=True)
tool_included_angle = fields.Char(string='刀尖角R角', readonly=True)
L_D = fields.Char(string='L/D', readonly=True)
coarse_middle_thin = fields.Selection([("1", ""), ('2', ''), ('3', '')], string='粗/中/精', readonly=True)
required_cutting_time = fields.Char(string='需要切割时间', readonly=True)
whether_standard_tool = fields.Boolean(string='是否标准刀', readonly=True)
need_knife_time = fields.Datetime(string='需要用刀时间', readonly=True)
name = fields.Char(string='工单任务编号', readonly=False)
cam_procedure_code = fields.Char(string='CAM程序编号', readonly=False)
cam_cutter_spacing_code = fields.Char(string='CAM刀位号', readonly=False)
functional_tool_code = fields.Char(string='功能刀具编码', readonly=False)
functional_tool_name_id = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=False)
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False)
machine_table_name_id = fields.Many2one('sf.machine_tool', string='机床名称', readonly=False)
machine_tool_cutter_spacing_code = fields.Char(string='机床刀位号', readonly=False)
diameter = fields.Char(string='直径(程式)', readonly=False)
tool_loading_length = fields.Char(string='装刀长', readonly=False)
clearance_length = fields.Char(string='避空长', readonly=False)
tool_included_angle = fields.Char(string='刀尖角R角', readonly=False)
L_D = fields.Char(string='L/D', readonly=False)
coarse_middle_thin = fields.Selection([("1", ""), ('2', ''), ('3', '')], string='粗/中/精', readonly=False)
required_cutting_time = fields.Char(string='需要切割时间', readonly=False)
whether_standard_tool = fields.Boolean(string='是否标准刀', readonly=False)
need_knife_time = fields.Datetime(string='需要用刀时间', readonly=False)
plan_execute_status = fields.Selection([('0', '待下发'), ('1', '执行中'), ('2', '已完成')],
string='计划执行状态', default='0', readonly=True)
string='计划执行状态', default='0', readonly=False)
applicant = fields.Char(string='申请人', readonly=True)
reason_for_applying = fields.Char(string='申请原因', readonly=True)
remark = fields.Char(string='备注说明', readonly=True)
reason_for_applying = fields.Char(string='申请原因', readonly=False)
remark = fields.Char(string='备注说明', readonly=False)
def automation_apply_for_tooling(self):
def apply_for_tooling(self):
"""
自动申请装刀
申请装刀
:return:
"""
self.env['sf.functional.tool.assembly'].create({
'functional_tool_code': self.functional_tool_code,
'name': self.functional_tool_name,
'functional_tool_type': self.functional_tool_type,
'name': self.functional_tool_name_id.id,
'functional_tool_type_id': self.functional_tool_type_id.id,
'functional_tool_diameter': self.diameter,
'functional_tool_length': self.tool_loading_length,
'loading_task_source': '0',
'coarse_middle_thin': None,
'tool_loading_length': None,
'applicant': self.applicant,
'applicant': self.env.user.name,
'reason_for_applying': self.reason_for_applying,
'use_tool_time': self.need_knife_time,
'machine_tool_name': self.machine_table_name,
'machine_tool_name_id': self.machine_table_name_id.id,
'machine_tool_code': self.cam_procedure_code,
'cutter_spacing_code': self.cam_cutter_spacing_code
})
# 将计划执行状态改为执行中
self.env['sf.cam.work.order.program.knife.plan'].search(
[('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '1'})
[('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '1',
'applicant': self.env.user.name})
def revocation(self):
"""
撤回装刀申请
:return:
"""
self.env['sf.functional.tool.assembly'].search(
[('functional_tool_code', '=', self.functional_tool_code)]).unlink()
[('functional_tool_code', '=', self.functional_tool_code),
('loading_task_source', '=', '0')]).unlink()
# 将计划执行状态改为待执行
self.env['sf.cam.work.order.program.knife.plan'].search(
[('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '0'})
[('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '0',
'applicant': None})
@@ -489,18 +502,57 @@ class FunctionalToolAssembly(models.Model):
_order = 'use_tool_time asc'
functional_tool_code = fields.Char(string='功能刀具编码', readonly=True)
name = fields.Char(string='功能刀具名称', readonly=True)
functional_tool_type = fields.Char(string='功能刀具类型', readonly=True)
name = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=True)
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True)
functional_tool_diameter = fields.Char(string='功能刀具直径', readonly=True)
functional_tool_length = fields.Char(string='功能刀具伸出长', readonly=True)
functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=True)
functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=False)
# 整体式刀具型号
mrs_cutting_tool_integral_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
string='整体式刀具型号', readonly=True, domain=
[('mrs_cutting_tool_material_name', '=', '整体式刀具')])
integral_code = fields.Char('整体式刀具序列号', readonly=True)
integral_name = fields.Char('整体式刀具名称', readonly=True)
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', '整体式刀具品牌', readonly=True)
# 刀片型号
mrs_cutting_tool_blade_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
string='刀片型号', readonly=True, domain=
[('mrs_cutting_tool_material_name', '=', '刀片')])
blade_code = fields.Char('刀片序列号', readonly=True)
blade_name = fields.Char('刀片名称', readonly=True)
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True)
# 刀杆型号
mrs_cutting_tool_cutterbar_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
string='刀杆型号', readonly=True, domain=
[('mrs_cutting_tool_material_name', '=', '刀杆')])
bar_code = fields.Char('刀杆序列号', readonly=True)
bar_name = fields.Char('刀杆名称', readonly=True)
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True)
# 刀盘型号
mrs_cutting_tool_cutterpad_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
string='刀盘型号', readonly=True, domain=
[('mrs_cutting_tool_material_name', '=', '刀盘')])
pad_code = fields.Char('刀盘序列号', readonly=True)
pad_name = fields.Char('刀盘名称', readonly=True)
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
# 刀柄型号
mrs_cutting_tool_cutterhandle_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
string='刀柄型号', readonly=True, domain=
[('mrs_cutting_tool_material_name', '=', '刀柄')])
handle_code = fields.Char('刀柄序列号', readonly=True)
handle_name = fields.Char('刀柄名称', readonly=True)
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
# 夹头型号
mrs_cutting_tool_cutterhead_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
string='夹头型号', readonly=True, domain=
[('mrs_cutting_tool_material_name', '=', '夹头')])
chuck_code = fields.Char('夹头序列号', readonly=True)
chuck_name = fields.Char('夹头名称', readonly=True)
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True)
tool_name = fields.Char(string='刀具名称', readonly=True)
tool_brand = fields.Char(string='品牌', readonly=True)
tool_type = fields.Char(string='型号', readonly=True)
knife_handle_name = fields.Char(string='刀柄名称', readonly=True)
knife_handle_brand = fields.Char(string='品牌', readonly=True)
knife_handle_type = fields.Char(string='型号', readonly=True)
coarse_middle_thin = fields.Selection([("1", ""), ('2', ''), ('3', '')], string='粗/中/精', readonly=True)
tool_loading_length = fields.Char(string='装刀长', readonly=True)
new_former = fields.Selection([('0', ''), ('1', '')], string='新/旧', readonly=True)
@@ -515,8 +567,8 @@ class FunctionalToolAssembly(models.Model):
apply_time = fields.Datetime(string='申请时间', default=fields.Datetime.now(), readonly=True)
assemble_status = fields.Selection([('0', '待组装'), ('1', '已组装'), ('2', '已出库')],string='组装状态', default='0', readonly=True)
use_tool_time = fields.Datetime(string='用刀时间', readonly=True)
production_line_name = fields.Char(string='产线名称', readonly=True)
machine_tool_name = fields.Char(string='机床名称', readonly=True)
production_line_name_id = fields.Many2one('sf.production.line', string='产线名称', readonly=False)
machine_tool_name_id = fields.Many2one('sf.machine_tool', string='机床名称', readonly=True)
machine_tool_code = fields.Char(string='机台号', readonly=True)
cutter_spacing_code = fields.Char(string='刀位号', readonly=True)
@@ -526,7 +578,7 @@ class FunctionalToolAssembly(models.Model):
receive_time = fields.Datetime(string='领用出库时间', readonly=True)
remark = fields.Char(string='备注说明', readonly=True)
check_box_1 = fields.Boolean(string='复选框', default=False, readonly=True)
check_box_1 = fields.Boolean(string='复选框', default=False, readonly=False)
@api.onchange('assemble_status')
def check_box(self):
@@ -540,15 +592,33 @@ class FunctionalToolAssembly(models.Model):
:return:
"""
self.env['sf.functional.tool.assembly'].search([
('machine_tool_name', '=', self.machine_tool_name),
('machine_tool_name_id', '=', self.machine_tool_name_id.id),
('cutter_spacing_code', '=', self.cutter_spacing_code)
]).write({
'tool_name': None,
'tool_brand': None,
'tool_type': None,
'knife_handle_name': None,
'knife_handle_brand': None,
'knife_handle_type': None,
'mrs_cutting_tool_integral_model_ids': None,
'integral_code': None,
'integral_name': None,
'sf_tool_brand_id_1': None,
'mrs_cutting_tool_blade_model_ids': None,
'blade_code': None,
'blade_name': None,
'sf_tool_brand_id_2': None,
'mrs_cutting_tool_cutterbar_model_ids': None,
'bar_code': None,
'bar_name': None,
'sf_tool_brand_id_3': None,
'mrs_cutting_tool_cutterpad_model_ids': None,
'pad_code': None,
'pad_name': None,
'sf_tool_brand_id_4': None,
'mrs_cutting_tool_cutterhandle_model_ids': None,
'handle_code': None,
'handle_name': None,
'sf_tool_brand_id_5': None,
'mrs_cutting_tool_cutterhead_model_ids': None,
'chuck_code': None,
'chuck_name': None,
'sf_tool_brand_id_6': None,
'coarse_middle_thin': None,
'tool_loading_length': None,
'new_former': None,
@@ -570,14 +640,13 @@ 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,
'name': val.name,
'functional_tool_type': val.functional_tool_type,
'production_line_name': val.production_line_name,
'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
@@ -585,9 +654,9 @@ class FunctionalToolAssembly(models.Model):
else:
self.env['sf.delivery.of.cargo.from.storage'].create({
'functional_tool_code': self.functional_tool_code,
'name': self.name,
'functional_tool_type': self.functional_tool_type,
'production_line_name': self.production_line_name,
'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