完成了弹窗换刀需求信息的视图和默认数据的同步
This commit is contained in:
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