增加合并下发向导,增加cnc模型的缺省tree视图
This commit is contained in:
1
sf_machine_connect/wizard/__init__.py
Normal file
1
sf_machine_connect/wizard/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import action_up
|
||||
116
sf_machine_connect/wizard/action_up.py
Normal file
116
sf_machine_connect/wizard/action_up.py
Normal file
@@ -0,0 +1,116 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import logging
|
||||
import os
|
||||
import json
|
||||
import hashlib
|
||||
import time
|
||||
import requests
|
||||
from datetime import datetime
|
||||
|
||||
from odoo import fields, models, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.addons.sf_machine_connect.models import py2opcua, ftp_operate
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class UpSelectWizard(models.TransientModel):
|
||||
_name = 'up.select.wizard'
|
||||
|
||||
workorder_id = fields.Many2one('mrp.workorder', string='工单', readonly=True)
|
||||
workcenter_id = fields.Many2one('mrp.workcenter', string='工作中心', related='workorder_id.workcenter_id', readonly=True)
|
||||
program_ids = fields.Many2many('sf.cnc.processing', string='程序列表')
|
||||
|
||||
def confirm_up(self):
|
||||
pass
|
||||
|
||||
# cnc_id1 = fields.Many2one('ir.attachment', compute='_compute_cnc_id')
|
||||
# sequence_number1 = fields.Char('序号', compute='_compute_cnc_id', default='0')
|
||||
# program_name1 = fields.Char('程序名', compute='_compute_cnc_id')
|
||||
# cutting_tool_name1 = fields.Char('刀具名称', compute='_compute_cnc_id')
|
||||
# cutting_tool_no1 = fields.Char('刀号', compute='_compute_cnc_id')
|
||||
# processing_type1 = fields.Char('加工类型', compute='_compute_cnc_id')
|
||||
# margin_x_y1 = fields.Char('余量_X/Y', compute='_compute_cnc_id')
|
||||
# margin_z1 = fields.Char('余量_Z', compute='_compute_cnc_id')
|
||||
# depth_of_processing_z1 = fields.Char('加工深度(Z)', compute='_compute_cnc_id')
|
||||
# cutting_tool_extension_length1 = fields.Char('刀具伸出长度', compute='_compute_cnc_id')
|
||||
# cutting_tool_handle_type1 = fields.Char('刀柄型号', compute='_compute_cnc_id')
|
||||
# estimated_processing_time1 = fields.Char('预计加工时间', compute='_compute_cnc_id')
|
||||
# remark1 = fields.Text('备注', compute='_compute_cnc_id')
|
||||
# cnc_id = fields.Many2one('sf.cnc.processing', '工单')
|
||||
# num = fields.Integer('索引', default=0)
|
||||
# cnc_id1 = fields.Many2one('ir.attachment')
|
||||
# sequence_number1 = fields.Char('序号', compute='_compute_cnc_id', default='1')
|
||||
# program_name1 = fields.Char('程序名')
|
||||
# cutting_tool_name1 = fields.Char('刀具名称')
|
||||
# cutting_tool_no1 = fields.Char('刀号')
|
||||
# processing_type1 = fields.Char('加工类型')
|
||||
# margin_x_y1 = fields.Char('余量_X/Y')
|
||||
# margin_z1 = fields.Char('余量_Z')
|
||||
# depth_of_processing_z1 = fields.Char('加工深度(Z)')
|
||||
# cutting_tool_extension_length1 = fields.Char('刀具伸出长度')
|
||||
# cutting_tool_handle_type1 = fields.Char('刀柄型号')
|
||||
# estimated_processing_time1 = fields.Char('预计加工时间')
|
||||
# remark1 = fields.Text('备注')
|
||||
# cnc_id = fields.Many2one('sf.cnc.processing', '工单')
|
||||
# num = fields.Integer('索引', default=0)
|
||||
# print(11111111111111111111111111111111111111111111111)
|
||||
# # @api.depends('program_ids')
|
||||
# def _compute_cnc_id(self):
|
||||
# print(222222222222222222222222222222222222222222)
|
||||
# workorder_id = self.env.context.get('default_workorder_id')
|
||||
# workorder = self.env['mrp.workorder'].sudo().search([('id', '=', workorder_id)])
|
||||
# # self.workcenter_id = workorder.workcent_id
|
||||
# print(workorder_id)
|
||||
#
|
||||
# lines = []
|
||||
# print(lines)
|
||||
# for item in workorder.cnc_ids:
|
||||
# # lines.append((4,item.id,0))
|
||||
# lines.append((4, item.id, 0))
|
||||
# print(lines)
|
||||
#
|
||||
# # print(self.cnc_id1, self.sequence_number1, self.program_name1, self.processing_type1,
|
||||
# # self.cutting_tool_handle_type1
|
||||
# # , self.cutting_tool_extension_length1, self.margin_z1, self.margin_z1, self.depth_of_processing_z1,
|
||||
# # self.cutting_tool_no1, self.cutting_tool_name1, self.estimated_processing_time1, self.remark1)
|
||||
# # else:
|
||||
# # self.write({
|
||||
# #
|
||||
# # # 'cnc_id1': item.cnc_id or '',
|
||||
# # # 'sequence_number1': item.sequence_number or '',
|
||||
# # # 'program_name1': item.program_name or '',
|
||||
# # # 'cutting_tool_name1': item.cutting_tool_name or '',
|
||||
# # # 'cutting_tool_no1': item.cutting_tool_no or '',
|
||||
# # # 'processing_type1': item.processing_type or '',
|
||||
# # # 'margin_x_y1': item.margin_x_y or '',
|
||||
# # # 'margin_z1': item.margin_z or '',
|
||||
# # # 'depth_of_processing_z1': item.depth_of_processing_z or '',
|
||||
# # # 'cutting_tool_extension_length1': item.cutting_tool_extension_length or '',
|
||||
# # # 'cutting_tool_handle_type1': item.cutting_tool_handle_type or '',
|
||||
# # # 'estimated_processing_time1': item.estimated_processing_time or '',
|
||||
# # # 'remark1': item.remark or '',
|
||||
# # 'id': item.sequence_number,
|
||||
# # 'cnc_id1': item.cnc_id,
|
||||
# # 'sequence_number1': item.sequence_number,
|
||||
# # 'program_name1': item.program_name,
|
||||
# # 'cutting_tool_name1': item.cutting_tool_name,
|
||||
# # 'cutting_tool_no1': item.cutting_tool_no,
|
||||
# # 'processing_type1': item.processing_type,
|
||||
# # 'margin_x_y1': item.margin_x_y,
|
||||
# # 'margin_z1': item.margin_z,
|
||||
# # 'depth_of_processing_z1': item.depth_of_processing_z,
|
||||
# # 'cutting_tool_extension_length1': item.cutting_tool_extension_length,
|
||||
# # 'cutting_tool_handle_type1': item.cutting_tool_handle_type,
|
||||
# # 'estimated_processing_time1': item.estimated_processing_time,
|
||||
# # 'remark1': item.remark,
|
||||
# # })
|
||||
# # print(self.cnc_id1, self.sequence_number1, self.program_name1, self.processing_type1,
|
||||
# # self.cutting_tool_handle_type1
|
||||
# # , self.cutting_tool_extension_length1, self.margin_z1, self.margin_z1,
|
||||
# # self.depth_of_processing_z1,
|
||||
# # self.cutting_tool_no1, self.cutting_tool_name1, self.estimated_processing_time1, self.remark1)
|
||||
#
|
||||
# self.update({'program_ids': lines})
|
||||
34
sf_machine_connect/wizard/up_select.xml
Normal file
34
sf_machine_connect/wizard/up_select.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="action_up_select_form" model="ir.ui.view">
|
||||
<field name="name">CNC工单</field>
|
||||
<field name="model">up.select.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<group>
|
||||
<field name="workcenter_id"/>
|
||||
<field name="workorder_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="program_ids" widget='many2many_tags' domain="[('workorder_id', '=', workorder_id)]"/>
|
||||
<!-- <field name="program_ids" domain="[('workorder_id', '=', workorder_id)]"/>-->
|
||||
</group>
|
||||
<footer>
|
||||
<button string="合并下发" name="confirm_up" type="object" class="btn-primary" confirm="是否确认合并下发"/>
|
||||
<button string="取消" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_up_select" model="ir.actions.act_window">
|
||||
<field name="name">选择要下发的NC程序</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<!-- <field name="res_model">up.select.wizard</field>-->
|
||||
<field name="res_model">up.select.wizard</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="action_up_select_form"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user