完成了弹窗换刀需求信息的视图和默认数据的同步
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
# -*-coding:utf-8-*-
|
# -*-coding:utf-8-*-
|
||||||
from . import models
|
from . import models
|
||||||
|
from . import wizard
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
'data': [
|
'data': [
|
||||||
'security/group_security.xml',
|
'security/group_security.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
|
'wizard/wizard_view.xml',
|
||||||
'views/tool_base_views.xml',
|
'views/tool_base_views.xml',
|
||||||
'views/menu_view.xml',
|
'views/menu_view.xml',
|
||||||
|
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -104,9 +104,12 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
_name = 'sf.machine.table.tool.changing.apply'
|
_name = 'sf.machine.table.tool.changing.apply'
|
||||||
_description = '机床换刀申请'
|
_description = '机床换刀申请'
|
||||||
|
|
||||||
|
apply_to_tool_change_ids = fields.One2many('sf.tool.change.requirement.information', 'tool_change_to_apply_id', string='换刀需求信息')
|
||||||
|
|
||||||
CNC_machine_table = fields.Char(string='CNC机床')
|
CNC_machine_table = 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}")
|
||||||
cutter_spacing_code = fields.Char(string='刀位号')
|
cutter_spacing_code = fields.Char(string='刀位号')
|
||||||
functional_tool_code = fields.Char(string='功能刀具编码')
|
functional_tool_code = fields.Char(string='功能刀具编码')
|
||||||
functional_tool_name = fields.Char(string='功能刀具名称')
|
functional_tool_name = fields.Char(string='功能刀具名称')
|
||||||
@@ -119,7 +122,7 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
max_lifetime_value = fields.Char(string='最大寿命值')
|
max_lifetime_value = fields.Char(string='最大寿命值')
|
||||||
alarm_value = fields.Char(string='报警值')
|
alarm_value = fields.Char(string='报警值')
|
||||||
used_value = fields.Char(string='已使用值')
|
used_value = fields.Char(string='已使用值')
|
||||||
functional_tool_status = fields.Selection([("0", "正常"), ('1', '异常')], string='功能刀具状态')
|
functional_tool_status = fields.Selection([('正常', '正常'), ('异常', '异常')], string='功能刀具状态')
|
||||||
|
|
||||||
replacement_tool_code = fields.Char(string='待换刀具编码')
|
replacement_tool_code = fields.Char(string='待换刀具编码')
|
||||||
replacement_tool_name = fields.Char(string='待换刀具名称')
|
replacement_tool_name = fields.Char(string='待换刀具名称')
|
||||||
@@ -154,12 +157,6 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
# 'name': source_record.name,
|
# 'name': source_record.name,
|
||||||
})
|
})
|
||||||
|
|
||||||
# todo
|
|
||||||
def tool_changing_apply(self):
|
|
||||||
"""
|
|
||||||
换刀申请(按键)
|
|
||||||
"""
|
|
||||||
|
|
||||||
# todo
|
# todo
|
||||||
def transfer(self):
|
def transfer(self):
|
||||||
"""
|
"""
|
||||||
@@ -171,11 +168,14 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
|||||||
_name = 'sf.cam.work.order.program.knife.plan'
|
_name = 'sf.cam.work.order.program.knife.plan'
|
||||||
_description = 'CAM工单程序用刀计划'
|
_description = 'CAM工单程序用刀计划'
|
||||||
|
|
||||||
CAM_cutter_spacing_code = fields.Char(string='CAM刀位号')
|
ticket_task_code = fields.Char(string='工单任务编号')
|
||||||
|
cam_procedure_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='功能刀具编码')
|
||||||
functional_tool_name = fields.Char(string='功能刀具名称')
|
functional_tool_name = fields.Char(string='功能刀具名称')
|
||||||
functional_tool_type = fields.Char(string='功能刀具类型')
|
functional_tool_type = fields.Char(string='功能刀具类型')
|
||||||
machine_table_name = fields.Char(string='机台名称')
|
machine_table_name = fields.Char(string='机床名称')
|
||||||
|
machine_tool_cutter_spacing_code = fields.Char(string='机床刀位号')
|
||||||
diameter = fields.Char(string='直径(程式)')
|
diameter = fields.Char(string='直径(程式)')
|
||||||
tool_loading_length = fields.Char(string='装刀长')
|
tool_loading_length = fields.Char(string='装刀长')
|
||||||
clearance_length = fields.Char(string='避空长')
|
clearance_length = fields.Char(string='避空长')
|
||||||
@@ -185,6 +185,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
|||||||
required_cutting_time = fields.Char(string='需要切割时间')
|
required_cutting_time = fields.Char(string='需要切割时间')
|
||||||
whether_standard_tool = fields.Boolean(string='是否标准刀')
|
whether_standard_tool = fields.Boolean(string='是否标准刀')
|
||||||
need_knife_time = fields.Datetime(string='需要用刀时间')
|
need_knife_time = fields.Datetime(string='需要用刀时间')
|
||||||
|
plan_execute_status = fields.Selection([('0', '待下发'), ('1', '执行中'), ('2', '已完成')], string='计划执行状态')
|
||||||
applicant = fields.Char(string='申请人')
|
applicant = fields.Char(string='申请人')
|
||||||
reason_for_applying = fields.Char(string='申请原因')
|
reason_for_applying = fields.Char(string='申请原因')
|
||||||
remark = fields.Char(string='备注说明')
|
remark = fields.Char(string='备注说明')
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ access_sf_cam_work_order_program_knife_plan,sf.cam.work.order.program.knife.plan
|
|||||||
access_sf_machine_table_tool_changing_apply,sf.machine.table.tool.changing.apply,model_sf_machine_table_tool_changing_apply,base.group_user,1,1,1,1
|
access_sf_machine_table_tool_changing_apply,sf.machine.table.tool.changing.apply,model_sf_machine_table_tool_changing_apply,base.group_user,1,1,1,1
|
||||||
|
|
||||||
|
|
||||||
|
access_sf_tool_change_requirement_information,sf.tool.change.requirement.information,model_sf_tool_change_requirement_information,base.group_user,1,1,1,1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
@@ -149,11 +149,14 @@
|
|||||||
<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="CAM_cutter_spacing_code"/>
|
<field name="ticket_task_code"/>
|
||||||
|
<field name="cam_procedure_code"/>
|
||||||
|
<field name="cam_cutter_spacing_code"/>
|
||||||
<field name="functional_tool_code"/>
|
<field name="functional_tool_code"/>
|
||||||
<field name="functional_tool_name"/>
|
<field name="functional_tool_name"/>
|
||||||
<field name="functional_tool_type"/>
|
<field name="functional_tool_type"/>
|
||||||
<field name="machine_table_name"/>
|
<field name="machine_table_name"/>
|
||||||
|
<field name="machine_tool_cutter_spacing_code"/>
|
||||||
<field name="diameter"/>
|
<field name="diameter"/>
|
||||||
<field name="tool_loading_length"/>
|
<field name="tool_loading_length"/>
|
||||||
<field name="clearance_length"/>
|
<field name="clearance_length"/>
|
||||||
@@ -163,6 +166,7 @@
|
|||||||
<field name="required_cutting_time"/>
|
<field name="required_cutting_time"/>
|
||||||
<field name="whether_standard_tool"/>
|
<field name="whether_standard_tool"/>
|
||||||
<field name="need_knife_time"/>
|
<field name="need_knife_time"/>
|
||||||
|
<field name="plan_execute_status"/>
|
||||||
<field name="applicant"/>
|
<field name="applicant"/>
|
||||||
<field name="reason_for_applying"/>
|
<field name="reason_for_applying"/>
|
||||||
<field name="remark"/>
|
<field name="remark"/>
|
||||||
@@ -186,6 +190,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree>
|
<tree>
|
||||||
<field name="CNC_machine_table"/>
|
<field name="CNC_machine_table"/>
|
||||||
|
<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"/>
|
||||||
<field name="functional_tool_code"/>
|
<field name="functional_tool_code"/>
|
||||||
@@ -200,7 +205,17 @@
|
|||||||
<field name="used_value"/>
|
<field name="used_value"/>
|
||||||
<field name="functional_tool_status"/>
|
<field name="functional_tool_status"/>
|
||||||
|
|
||||||
<button string="换刀申请" name="tool_changing_apply"/>
|
<button string="换刀申请"
|
||||||
|
name="%(sf_tool_management.sf_tool_change_requirement_information_act)d"
|
||||||
|
type="action"
|
||||||
|
context="{ 'default_CNC_machine_table':CNC_machine_table,
|
||||||
|
'default_machine_tool_code': machine_tool_code,
|
||||||
|
'default_cutter_spacing_code': cutter_spacing_code,
|
||||||
|
'default_replacement_tool_code': functional_tool_code,
|
||||||
|
'default_replacement_tool_name': functional_tool_name,
|
||||||
|
'default_replacement_tool_type': functional_tool_type,
|
||||||
|
'default_replacement_tool_coarse_middle_thin': coarse_middle_thin}"
|
||||||
|
attrs="{'invisible': [('functional_tool_status', '=', '正常')]}"/>
|
||||||
<button string="转移" name="transfer"/>
|
<button string="转移" name="transfer"/>
|
||||||
|
|
||||||
<field name="replacement_tool_code"/>
|
<field name="replacement_tool_code"/>
|
||||||
@@ -216,6 +231,10 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- <record id="sf_machine_table_tool_changing_apply_search" model="ir.ui.view">-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<record id="sf_machine_table_tool_changing_apply_view_act" model="ir.actions.act_window">
|
<record id="sf_machine_table_tool_changing_apply_view_act" model="ir.actions.act_window">
|
||||||
<field name="name">机床换刀申请</field>
|
<field name="name">机床换刀申请</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
|||||||
1
sf_tool_management/wizard/__init__.py
Normal file
1
sf_tool_management/wizard/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import wizard
|
||||||
35
sf_tool_management/wizard/wizard.py
Normal file
35
sf_tool_management/wizard/wizard.py
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
from odoo import fields, models, api
|
||||||
|
|
||||||
|
|
||||||
|
class ToolChangeRequirementInformation(models.TransientModel):
|
||||||
|
_name = 'sf.tool.change.requirement.information'
|
||||||
|
_description = '换刀需求信息'
|
||||||
|
|
||||||
|
tool_change_to_apply_id = fields.Many2one('sf.machine.table.tool.changing.apply', string='机床换刀申请')
|
||||||
|
|
||||||
|
CNC_machine_table = fields.Char(string='CNC机床', readonly=True)
|
||||||
|
machine_tool_code = fields.Char(string='机台号', readonly=True)
|
||||||
|
cutter_spacing_code = fields.Char(string='刀位号', readonly=True)
|
||||||
|
|
||||||
|
replacement_tool_code = fields.Char(string='待换刀具编码')
|
||||||
|
replacement_tool_name = fields.Char(string='待换刀具名称')
|
||||||
|
replacement_tool_type = fields.Char(string='待换刀具类型')
|
||||||
|
replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')],
|
||||||
|
string='粗/中/精')
|
||||||
|
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧')
|
||||||
|
applicant = fields.Char(string='申请人')
|
||||||
|
used_tool_time = fields.Datetime(string='用刀时间')
|
||||||
|
reason_for_applying = fields.Char(string='申请原因')
|
||||||
|
remark = fields.Char(string='备注说明')
|
||||||
|
|
||||||
|
# todo 未完成
|
||||||
|
def tool_changing_apply(self):
|
||||||
|
"""
|
||||||
|
确认换刀申请(按键)
|
||||||
|
"""
|
||||||
|
# 将数据更新到换刀申请
|
||||||
|
self.tool_change_to_apply_id.write({'replacement_tool_name': self.replacement_tool_name})
|
||||||
|
self.env.cr.commit()
|
||||||
|
|
||||||
|
# 关闭弹出窗口
|
||||||
|
return {'type': 'ir.actions.act_window_close'}
|
||||||
57
sf_tool_management/wizard/wizard_view.xml
Normal file
57
sf_tool_management/wizard/wizard_view.xml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="sf_tool_change_requirement_information_form" model="ir.ui.view">
|
||||||
|
<field name="name">换刀需求信息</field>
|
||||||
|
<field name="model">sf.tool.change.requirement.information</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="换刀需求信息">
|
||||||
|
<sheet>
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="CNC_machine_table"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="machine_tool_code"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="cutter_spacing_code"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="replacement_tool_name"/>
|
||||||
|
<field name="replacement_tool_type"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="replacement_tool_coarse_middle_thin"/>
|
||||||
|
<field name="used_tool_time"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="new_former"/>
|
||||||
|
<field name="applicant"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="reason_for_applying"/>
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
<footer>
|
||||||
|
<button string="确定" name="tool_changing_apply" type="object" class="btn-primary" confirm="是否确认申请换刀"/>
|
||||||
|
<button string="取消" class="btn-secondary" special="cancel"/>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="sf_tool_change_requirement_information_act" model="ir.actions.act_window">
|
||||||
|
<field name="name">换刀需求信息</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">sf.tool.change.requirement.information</field>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="view_id" ref="sf_tool_change_requirement_information_form"/>
|
||||||
|
<field name="target">new</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user