diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index a33c7df1..d4d1a7ba 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -104,7 +104,11 @@ class MachineTableToolChangingApply(models.Model): _name = 'sf.machine.table.tool.changing.apply' _description = '机床换刀申请' - apply_to_tool_change_ids = fields.One2many('sf.tool.change.requirement.information', 'tool_change_to_apply_id', string='换刀需求信息') + apply_to_tool_change_ids = fields.One2many( + 'sf.tool.change.requirement.information', + 'tool_change_to_apply_id', + string='换刀需求信息', + attrs="{'invisible': 1}") CNC_machine_table = fields.Char(string='CNC机床') # todo 机床类型和刀位号 为 Many2one @@ -135,32 +139,61 @@ class MachineTableToolChangingApply(models.Model): reason_for_applying = fields.Char(string='申请原因') remark = fields.Char(string='备注说明') - def sync_tool_entity_from_tool_changing_apply_table(self): - """ - ‘功能刀具预警’数据同步到‘机床换刀申请’ - """ - # 获取源表中的所有记录 - source_records = self.env['sf.functional.cutting.tool.entity'].search([]) + # def sync_tool_entity_from_tool_changing_apply_table(self): + # """ + # ‘功能刀具预警’数据同步到‘机床换刀申请’ + # """ + # # 获取源表中的所有记录 + # source_records = self.env['sf.functional.cutting.tool.entity'].search([]) + # + # # 循环遍历每个记录 + # for source_record in source_records: + # # 检查目标表中是否存在相同的记录 + # destination_record = self.search([('CNC_machine_table', '=', source_record.machine_tool_code)]) + # if destination_record: + # # todo 如果目标表中已经存在相同的记录,则更新该记录 + # destination_record.name = source_record.name + # else: + # # todo 如果目标表中不存在相同的记录,则创建一个新记录 + # destination_record = self.create({ + # # 'name': source_record.name, + # }) - # 循环遍历每个记录 - for source_record in source_records: - # 检查目标表中是否存在相同的记录 - destination_record = self.search([('CNC_machine_table', '=', source_record.machine_tool_code)]) - if destination_record: - # 如果目标表中已经存在相同的记录,则更新该记录 - # todo - destination_record.name = source_record.name - else: - # 如果目标表中不存在相同的记录,则创建一个新记录 - destination_record = self.create({ - # todo - # 'name': source_record.name, - }) - - # todo - def transfer(self): + def amendant_record(self, vals): """ - 转移(按键) + 确认换刀申请(按键) + 将弹窗数据更新到记录 + :param vals: + :return: + """ + self.env['sf.machine.table.tool.changing.apply'].search( + [('CNC_machine_table', '=', vals.get('CNC_machine_table'))]).write(vals) + + def revocation_1(self): + """ + 换刀申请撤回按键 + :return: + """ + # 撤回数据更新 + self.env['sf.machine.table.tool.changing.apply'].search( + [('CNC_machine_table', '=', self.CNC_machine_table)]).write({ + 'replacement_tool_code': False, + 'replacement_tool_name': False, + 'replacement_tool_type': False, + 'replacement_tool_coarse_middle_thin': False, + 'new_former': False, + 'applicant': False, + 'used_tool_time': False, + 'reason_for_applying': False, + 'remark': False + }) + + # todo 撤回功能刀具组装创建新任务 + + def revocation_1(self): + """ + 转移撤回按键 + :return: """ @@ -189,9 +222,3 @@ class CAMWorkOrderProgramKnifePlan(models.Model): applicant = fields.Char(string='申请人') reason_for_applying = fields.Char(string='申请原因') remark = fields.Char(string='备注说明') - - # todo - def tool_loading_apply(self): - """ - 装刀申请(按键) - """ diff --git a/sf_tool_management/security/ir.model.access.csv b/sf_tool_management/security/ir.model.access.csv index ebc4d2db..e97c88f8 100644 --- a/sf_tool_management/security/ir.model.access.csv +++ b/sf_tool_management/security/ir.model.access.csv @@ -5,6 +5,8 @@ access_sf_machine_table_tool_changing_apply,sf.machine.table.tool.changing.apply access_sf_tool_change_requirement_information,sf.tool.change.requirement.information,model_sf_tool_change_requirement_information,base.group_user,1,1,1,1 +access_sf_tool_transfer_request_information,sf.tool.transfer.request.information,model_sf_tool_transfer_request_information,base.group_user,1,1,1,1 +access_sf_apply_for_tooling,sf.apply.for.tooling,model_sf_apply_for_tooling,base.group_user,1,1,1,1 diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index 6637d0e9..22c780cd 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -143,6 +143,79 @@ + + + 机床换刀申请 + sf.machine.table.tool.changing.apply + + + + + + + + + + + + + + + + + + +