完成了弹窗换刀需求信息的视图和默认数据的同步

This commit is contained in:
yuxianghui
2023-06-21 17:21:58 +08:00
parent 6caae0325a
commit f135f0a5e7
8 changed files with 129 additions and 12 deletions

View 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'}