优化刀具管理form视图表名显示问题

This commit is contained in:
yuxianghui
2023-07-14 17:24:59 +08:00
parent a8e30a5228
commit 9c4f51d5f6
2 changed files with 23 additions and 23 deletions

View File

@@ -110,7 +110,7 @@ class MachineTableToolChangingApply(models.Model):
# string='换刀需求信息', # string='换刀需求信息',
# attrs="{'invisible': 1}") # attrs="{'invisible': 1}")
CNC_machine_table = fields.Char(string='CNC机床') name = fields.Char(string='CNC机床')
# todo 机床类型和刀位号 为 Many2one # todo 机床类型和刀位号 为 Many2one
machine_table_type = fields.Char(string='机床类型') machine_table_type = fields.Char(string='机床类型')
machine_tool_code = fields.Char(string='机台号', attrs="{'invisible': 1}") machine_tool_code = fields.Char(string='机台号', attrs="{'invisible': 1}")
@@ -151,7 +151,7 @@ class MachineTableToolChangingApply(models.Model):
# todo 自动换刀申请条件需补充完善 # todo 自动换刀申请条件需补充完善
if(self.functional_tool_status == '异常'): if(self.functional_tool_status == '异常'):
self.env['sf.machine.table.tool.changing.apply'].search([ self.env['sf.machine.table.tool.changing.apply'].search([
('CNC_machine_table', '=', self.CNC_machine_table)]).write({ ('name', '=', self.name)]).write({
'replacement_tool_code': self.functional_tool_code, 'replacement_tool_code': self.functional_tool_code,
'replacement_tool_name': self.functional_tool_name, 'replacement_tool_name': self.functional_tool_name,
'replacement_tool_type': self.functional_tool_type, 'replacement_tool_type': self.functional_tool_type,
@@ -167,7 +167,7 @@ class MachineTableToolChangingApply(models.Model):
# 新建组装任务 # 新建组装任务
self.env['sf.functional.tool.assembly'].create({ self.env['sf.functional.tool.assembly'].create({
'functional_tool_code': self.functional_tool_code, 'functional_tool_code': self.functional_tool_code,
'functional_tool_name': self.functional_tool_name, 'name': self.functional_tool_name,
'functional_tool_type': self.functional_tool_type, 'functional_tool_type': self.functional_tool_type,
'functional_tool_diameter': self.diameter, 'functional_tool_diameter': self.diameter,
'loading_task_source': '1', 'loading_task_source': '1',
@@ -189,7 +189,7 @@ class MachineTableToolChangingApply(models.Model):
""" """
# 增加设置直径的值 # 增加设置直径的值
tool_changing_apply = self.env['sf.machine.table.tool.changing.apply'].search( tool_changing_apply = self.env['sf.machine.table.tool.changing.apply'].search(
[('CNC_machine_table', '=', vals['machine_tool_name'])]) [('name', '=', vals['name'])])
vals['functional_tool_diameter'] = tool_changing_apply.diameter vals['functional_tool_diameter'] = tool_changing_apply.diameter
self.env['sf.functional.tool.assembly'].create(vals) self.env['sf.functional.tool.assembly'].create(vals)
@@ -201,7 +201,7 @@ class MachineTableToolChangingApply(models.Model):
:return: :return:
""" """
# 撤回数据更新 # 撤回数据更新
self.env['sf.machine.table.tool.changing.apply'].search([('CNC_machine_table', '=', self.CNC_machine_table)]).write({ self.env['sf.machine.table.tool.changing.apply'].search([('name', '=', self.name)]).write({
'replacement_tool_code': None, 'replacement_tool_code': None,
'replacement_tool_name': None, 'replacement_tool_name': None,
'replacement_tool_type': None, 'replacement_tool_type': None,
@@ -225,7 +225,7 @@ class MachineTableToolChangingApply(models.Model):
:return: :return:
""" """
self.env['sf.machine.table.tool.changing.apply'].search( self.env['sf.machine.table.tool.changing.apply'].search(
[('CNC_machine_table', '=', self.CNC_machine_table)]).write({ [('name', '=', self.name)]).write({
'status': '0' 'status': '0'
}) })
@@ -234,7 +234,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
_name = 'sf.cam.work.order.program.knife.plan' _name = 'sf.cam.work.order.program.knife.plan'
_description = 'CAM工单程序用刀计划' _description = 'CAM工单程序用刀计划'
ticket_task_code = fields.Char(string='工单任务编号') name = fields.Char(string='工单任务编号')
cam_procedure_code = fields.Char(string='CAM程序编号') cam_procedure_code = fields.Char(string='CAM程序编号')
cam_cutter_spacing_code = fields.Char(string='CAM刀位号') cam_cutter_spacing_code = fields.Char(string='CAM刀位号')
functional_tool_code = fields.Char(string='功能刀具编码') functional_tool_code = fields.Char(string='功能刀具编码')
@@ -263,7 +263,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
""" """
self.env['sf.functional.tool.assembly'].create({ self.env['sf.functional.tool.assembly'].create({
'functional_tool_code': self.functional_tool_code, 'functional_tool_code': self.functional_tool_code,
'functional_tool_name': self.functional_tool_name, 'name': self.functional_tool_name,
'functional_tool_type': self.functional_tool_type, 'functional_tool_type': self.functional_tool_type,
'functional_tool_diameter': self.diameter, 'functional_tool_diameter': self.diameter,
'functional_tool_length': self.tool_loading_length, 'functional_tool_length': self.tool_loading_length,
@@ -304,7 +304,7 @@ class FunctionalToolAssembly(models.Model):
_order = 'use_tool_time asc' _order = 'use_tool_time asc'
functional_tool_code = fields.Char(string='功能刀具编码') functional_tool_code = fields.Char(string='功能刀具编码')
functional_tool_name = fields.Char(string='功能刀具名称') name = fields.Char(string='功能刀具名称')
functional_tool_type = fields.Char(string='功能刀具类型') functional_tool_type = fields.Char(string='功能刀具类型')
functional_tool_diameter = fields.Char(string='功能刀具直径') functional_tool_diameter = fields.Char(string='功能刀具直径')
functional_tool_length = fields.Char(string='功能刀具伸出长') functional_tool_length = fields.Char(string='功能刀具伸出长')
@@ -389,7 +389,7 @@ class FunctionalToolAssembly(models.Model):
for val in vals: for val in vals:
self.env['sf.delivery.of.cargo.from.storage'].create({ self.env['sf.delivery.of.cargo.from.storage'].create({
'functional_tool_code': val.functional_tool_code, 'functional_tool_code': val.functional_tool_code,
'functional_tool_name': val.functional_tool_name, 'name': val.name,
'functional_tool_type': val.functional_tool_type, 'functional_tool_type': val.functional_tool_type,
'production_line_name': val.production_line_name, 'production_line_name': val.production_line_name,
'machine_tool_code': val.machine_tool_code, 'machine_tool_code': val.machine_tool_code,
@@ -399,7 +399,7 @@ class FunctionalToolAssembly(models.Model):
else: else:
self.env['sf.delivery.of.cargo.from.storage'].create({ self.env['sf.delivery.of.cargo.from.storage'].create({
'functional_tool_code': self.functional_tool_code, 'functional_tool_code': self.functional_tool_code,
'functional_tool_name': self.functional_tool_name, 'name': self.name,
'functional_tool_type': self.functional_tool_type, 'functional_tool_type': self.functional_tool_type,
'production_line_name': self.production_line_name, 'production_line_name': self.production_line_name,
'machine_tool_code': self.machine_tool_code, 'machine_tool_code': self.machine_tool_code,

View File

@@ -169,7 +169,7 @@
<field name="model">sf.machine.table.tool.changing.apply</field> <field name="model">sf.machine.table.tool.changing.apply</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree> <tree>
<field name="CNC_machine_table"/> <field name="name"/>
<field name="machine_tool_code" invisible="1"/> <field name="machine_tool_code" invisible="1"/>
<field name="machine_table_type"/> <field name="machine_table_type"/>
<field name="cutter_spacing_code"/> <field name="cutter_spacing_code"/>
@@ -189,7 +189,7 @@
<button string="换刀申请" <button string="换刀申请"
name="%(sf_tool_management.sf_tool_change_requirement_information_act)d" name="%(sf_tool_management.sf_tool_change_requirement_information_act)d"
type="action" type="action"
context="{ 'default_CNC_machine_table':CNC_machine_table, context="{ 'default_name':name,
'default_machine_tool_code': machine_tool_code, 'default_machine_tool_code': machine_tool_code,
'default_cutter_spacing_code': cutter_spacing_code, 'default_cutter_spacing_code': cutter_spacing_code,
'default_replacement_tool_code': functional_tool_code, 'default_replacement_tool_code': functional_tool_code,
@@ -204,11 +204,11 @@
<button string="转移" <button string="转移"
name="%(sf_tool_management.sf_tool_transfer_request_information_act)d" name="%(sf_tool_management.sf_tool_transfer_request_information_act)d"
type="action" type="action"
context="{ 'default_CNC_machine_table':CNC_machine_table, context="{ 'default_name':name,
'default_machine_tool_code': machine_tool_code, 'default_machine_tool_code': machine_tool_code,
'default_cutter_spacing_code': cutter_spacing_code, 'default_cutter_spacing_code': cutter_spacing_code,
'default_functional_tool_code': functional_tool_code, 'default_functional_tool_code': functional_tool_code,
'default_functional_tool_name': functional_tool_name, 'default_name': functional_tool_name,
'default_functional_tool_type': functional_tool_type}" 'default_functional_tool_type': functional_tool_type}"
class="btn-primary" class="btn-primary"
attrs="{'invisible': [('status', '!=', '0')]}" attrs="{'invisible': [('status', '!=', '0')]}"
@@ -235,7 +235,7 @@
<field name="model">sf.machine.table.tool.changing.apply</field> <field name="model">sf.machine.table.tool.changing.apply</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search> <search>
<field name="CNC_machine_table"/> <field name="name"/>
<field name="machine_tool_code" invisible="1"/> <field name="machine_tool_code" invisible="1"/>
<field name="machine_table_type"/> <field name="machine_table_type"/>
<field name="cutter_spacing_code"/> <field name="cutter_spacing_code"/>
@@ -279,7 +279,7 @@
<field name="model">sf.cam.work.order.program.knife.plan</field> <field name="model">sf.cam.work.order.program.knife.plan</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree> <tree>
<field name="ticket_task_code"/> <field name="name"/>
<field name="cam_procedure_code"/> <field name="cam_procedure_code"/>
<field name="cam_cutter_spacing_code"/> <field name="cam_cutter_spacing_code"/>
<field name="functional_tool_code"/> <field name="functional_tool_code"/>
@@ -303,12 +303,12 @@
<button string="装刀申请" <button string="装刀申请"
name="%(sf_tool_management.sf_apply_for_tooling_act)d" name="%(sf_tool_management.sf_apply_for_tooling_act)d"
type="action" type="action"
context="{ 'default_ticket_task_code':ticket_task_code, context="{ 'default_name':name,
'default_cam_procedure_code': cam_procedure_code, 'default_cam_procedure_code': cam_procedure_code,
'default_machine_table_name': machine_table_name, 'default_machine_table_name': machine_table_name,
'default_cam_cutter_spacing_code': cam_cutter_spacing_code, 'default_cam_cutter_spacing_code': cam_cutter_spacing_code,
'default_functional_tool_code': functional_tool_code, 'default_functional_tool_code': functional_tool_code,
'default_functional_tool_name': functional_tool_name, 'default_name': functional_tool_name,
'default_functional_tool_type': functional_tool_type, 'default_functional_tool_type': functional_tool_type,
'default_diameter': diameter, 'default_diameter': diameter,
'default_tool_loading_length': tool_loading_length, 'default_tool_loading_length': tool_loading_length,
@@ -335,7 +335,7 @@
<field name="model">sf.cam.work.order.program.knife.plan</field> <field name="model">sf.cam.work.order.program.knife.plan</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search> <search>
<field name="ticket_task_code"/> <field name="name"/>
<field name="cam_procedure_code"/> <field name="cam_procedure_code"/>
<field name="cam_cutter_spacing_code"/> <field name="cam_cutter_spacing_code"/>
<field name="functional_tool_code"/> <field name="functional_tool_code"/>
@@ -375,7 +375,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree> <tree>
<field name="functional_tool_code"/> <field name="functional_tool_code"/>
<field name="functional_tool_name"/> <field name="name"/>
<field name="functional_tool_type"/> <field name="functional_tool_type"/>
<field name="functional_tool_diameter"/> <field name="functional_tool_diameter"/>
<field name="functional_tool_length"/> <field name="functional_tool_length"/>
@@ -404,7 +404,7 @@
context="{ context="{
'default_machine_tool_name': machine_tool_name, 'default_machine_tool_name': machine_tool_name,
'default_cutter_spacing_code': cutter_spacing_code, 'default_cutter_spacing_code': cutter_spacing_code,
'default_functional_tool_name': functional_tool_name, 'default_name': name,
'default_functional_tool_type': functional_tool_type, 'default_functional_tool_type': functional_tool_type,
'default_functional_tool_length': functional_tool_length, 'default_functional_tool_length': functional_tool_length,
'default_effective_length': None, 'default_effective_length': None,
@@ -449,7 +449,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<search> <search>
<field name="functional_tool_code"/> <field name="functional_tool_code"/>
<field name="functional_tool_name"/> <field name="name"/>
<field name="functional_tool_type"/> <field name="functional_tool_type"/>
<field name="functional_tool_diameter"/> <field name="functional_tool_diameter"/>
<field name="functional_tool_length"/> <field name="functional_tool_length"/>