1.产品模板优化:增加产品类别的搜索面板
2.夹具型号注册到cloud:夹具型号的Tree和form视图去掉不可增删改操作,页面新增时编码根据夹具物料回显不同的编码;新增注册按钮及对应的注册接口 3.功能夹具注册到cloud:.功能夹具的Tree和form视图去掉不可增删改操作,页面新增时编码和名称根据功能夹具类型和对应的托盘型号所进行回显
This commit is contained in:
@@ -1,4 +1,14 @@
|
||||
from odoo import models, fields, api
|
||||
from odoo.modules import get_resource_path
|
||||
# from OCC.Extend.DataExchange import read_step_file
|
||||
# from OCC.Extend.DataExchange import write_stl_file
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo.exceptions import ValidationError
|
||||
import requests
|
||||
import json
|
||||
import logging
|
||||
import base64
|
||||
import hashlib
|
||||
|
||||
|
||||
class FixtureMaterial(models.Model):
|
||||
@@ -26,7 +36,6 @@ class FixtureModel(models.Model):
|
||||
_name = 'sf.fixture.model'
|
||||
_description = "夹具型号"
|
||||
|
||||
code = fields.Char(string='编码')
|
||||
name = fields.Char(string="名称", size=15)
|
||||
fixture_material_id = fields.Many2one('sf.fixture.material', string="夹具物料", )
|
||||
fixture_material_type = fields.Char(string="夹具物料类型", related='fixture_material_id.name', store=True)
|
||||
@@ -40,14 +49,181 @@ class FixtureModel(models.Model):
|
||||
width = fields.Char(string="宽度[mm]", size=6)
|
||||
height = fields.Char(string="高度[mm]", size=6)
|
||||
weight = fields.Char(string="重量[kg]", size=4)
|
||||
clamp_workpiece_length_max = fields.Char(string="夹持工件长度MAX[mm]", size=6)
|
||||
clamp_workpiece_width_max = fields.Char(string="夹持工件宽度MAX[mm]", size=6)
|
||||
clamp_workpiece_height_max = fields.Char(string="夹持工件高度MAX[mm]", size=6)
|
||||
clamp_workpiece_diameter_max = fields.Char(string="夹持工件直径MAX[mm]", size=6)
|
||||
maximum_carrying_weight = fields.Char(string="最大承载重量[kg]", size=4)
|
||||
maximum_clamping_force = fields.Char(string="最大夹持力[n]", size=8)
|
||||
clamp_workpiece_length_max = fields.Integer(string="夹持工件长度MAX[mm]", size=6)
|
||||
clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度MAX[mm]", size=6)
|
||||
clamp_workpiece_height_max = fields.Integer(string="夹持工件高度MAX[mm]", size=6)
|
||||
clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径MAX[mm]", size=6)
|
||||
maximum_carrying_weight = fields.Float(string="最大承载重量[kg]", size=4)
|
||||
maximum_clamping_force = fields.Integer(string="最大夹持力[n]", size=8)
|
||||
materials_model_id = fields.Many2one('sf.materials.model', string="材料型号")
|
||||
driving_way = fields.Char(string="驱动方式")
|
||||
apply_machine_tool_type_id = fields.Many2one('sf.machine_tool.type', string="适用机床型号")
|
||||
driving_way = fields.Selection([('气动', '气动'), ('液压', '液压'), ('机械', '机械')], string="驱动方式")
|
||||
apply_machine_tool_type_ids = fields.Many2many('sf.machine_tool.type', 'rel_fixture_model_machine_tool_type',
|
||||
string="适用机床型号")
|
||||
through_hole_size = fields.Integer(string="过孔大小[mm]", size=6)
|
||||
screw_size = fields.Integer(string="螺牙大小[mm]", size=6)
|
||||
upload_model_file = fields.Many2many('ir.attachment', 'upload_fixture_model_file_attachment_ref', string='上传模型文件')
|
||||
|
||||
def _get_code(self, fixture_model_type_code):
|
||||
fixture_model = self.env['sf.fixture.model'].sudo().search(
|
||||
[('code', 'ilike', fixture_model_type_code)],
|
||||
limit=1,
|
||||
order="id desc")
|
||||
if not fixture_model:
|
||||
num = "%03d" % 1
|
||||
else:
|
||||
m = int(fixture_model.code[-3:]) + 1
|
||||
num = "%03d" % m
|
||||
return "%s%s" % (fixture_model_type_code, num)
|
||||
|
||||
code = fields.Char(string='编码', readonly=True)
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if vals.get('upload_model_file'):
|
||||
logging.info('create-attachment:%s' % vals['upload_model_file'][0])
|
||||
for item in vals['upload_model_file']:
|
||||
print(len(item[2]))
|
||||
if len(item[2]) > 0:
|
||||
logging.info('create-attachment:%s' % int(item[2][0]))
|
||||
attachment = self.env['ir.attachment'].sudo().search([('id', '=', int(item[2][0]))])
|
||||
base64_data = base64.b64encode(attachment.datas)
|
||||
base64_datas = base64_data.decode('utf-8')
|
||||
model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
|
||||
report_path = attachment._full_path(attachment.store_fname)
|
||||
vals['model_file'] = self.transition_glb_file(report_path, model_code)
|
||||
logging.info('create-model_file:%s' % len(vals['model_file']))
|
||||
obj = super(FixtureModel, self).create(vals)
|
||||
return obj
|
||||
|
||||
# 将attach的datas内容转为glb文件
|
||||
def transition_glb_file(self, report_path, model_code):
|
||||
shapes = read_step_file(report_path)
|
||||
# output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl')
|
||||
# output_file = os.path.join('/tmp', str(model_code) + '.stl')
|
||||
# write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
|
||||
# # 转化为glb
|
||||
# # output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.glb')
|
||||
# output_glb_file = os.path.join('/tmp', str(model_code) + '.glb')
|
||||
# util_path = get_resource_path('mrs_base', 'static/util')
|
||||
# cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
|
||||
# os.system(cmd)
|
||||
# # 转base64
|
||||
# with open(output_glb_file, 'rb') as fileObj:
|
||||
# image_data = fileObj.read()
|
||||
# base64_data = base64.b64encode(image_data)
|
||||
# return base64_data
|
||||
return False
|
||||
|
||||
@api.onchange('brand_id')
|
||||
def _onchange_brand_id(self):
|
||||
if self.brand_id:
|
||||
self.manufacturer_model_number = self.brand_id.manufacturer_model_number
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for parameter in self:
|
||||
if parameter.fixture_material_type in ['虎钳托盘', '零点卡盘']:
|
||||
if parameter.driving_way:
|
||||
name = parameter.multi_mounting_type_id.name + '-' + parameter.driving_way + '-' + parameter.name
|
||||
else:
|
||||
name = parameter.multi_mounting_type_id.name + '-' + parameter.name
|
||||
else:
|
||||
name = parameter.multi_mounting_type_id.name + '-' + parameter.name
|
||||
result.append((parameter.id, name))
|
||||
return result
|
||||
|
||||
@api.onchange('fixture_material_id')
|
||||
def _onchange_fixture_material_id(self):
|
||||
if self.fixture_material_id:
|
||||
if self.fixture_material_id.name == "气动托盘":
|
||||
self.code = self._get_code("JKM-C-JJWL-QDTP-")
|
||||
elif self.fixture_material_id.name == "转接板(锁板)托盘":
|
||||
self.code = self._get_code("JKM-C-JJWL-ZJBTP-")
|
||||
elif self.fixture_material_id.name == "磁吸托盘":
|
||||
self.code = self._get_code("JKM-C-JJWL-CXTP-")
|
||||
elif self.fixture_material_id.name == "虎钳托盘":
|
||||
self.code = self._get_code("JKM-C-JJWL-HQTP-")
|
||||
else:
|
||||
self.code = self._get_code("JKM-C-JJWL-LDKP-")
|
||||
|
||||
@api.onchange('upload_model_file')
|
||||
def onchange_model_file(self):
|
||||
for item in self:
|
||||
if len(item.upload_model_file) > 1:
|
||||
raise ValidationError('只允许上传一个文件')
|
||||
if item.upload_model_file:
|
||||
file_attachment_id = item.upload_model_file[0]
|
||||
# 附件路径
|
||||
report_path = file_attachment_id._full_path(file_attachment_id.store_fname)
|
||||
logging.info("模型路径: %s" % report_path)
|
||||
base64_data = base64.b64encode(file_attachment_id.datas)
|
||||
base64_datas = base64_data.decode('utf-8')
|
||||
model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
|
||||
logging.info("模型编码: %s" % model_code)
|
||||
item.model_file = self.transition_glb_file(report_path, model_code)
|
||||
else:
|
||||
item.model_file = False
|
||||
|
||||
def _json_apply_machine_tool_type_item_code(self, item):
|
||||
code_arr = []
|
||||
for i in item.apply_machine_tool_type_ids:
|
||||
code_arr.append(i.code)
|
||||
return code_arr
|
||||
|
||||
|
||||
# 注册到cloud的夹具型号中
|
||||
def register_fixture_model(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
strurl = sf_sync_config['sf_url'] + self.crea_url
|
||||
objs_all = self.search([('code', '=', self.code)])
|
||||
fixture_model_list = []
|
||||
if objs_all:
|
||||
for item in objs_all:
|
||||
val = {
|
||||
'code': item.code,
|
||||
'factory_token': token,
|
||||
'name': item.name,
|
||||
'code': item.code,
|
||||
'fixture_material_code': self.env['sf.fixture.material'].search(
|
||||
[('id', '=', item.fixture_material_id.id)]).code,
|
||||
'multi_mounting_type_code': self.env['sf.multi_mounting.type'].search(
|
||||
[('id', '=', item.multi_mounting_type_id.id)]).code,
|
||||
'brand_code': self.env['sf.machine.brand'].search(
|
||||
[('id', '=', item.brand_id.id)]).code,
|
||||
'manufacturer_model_number': item.manufacturer_model_number,
|
||||
'clamping_way': item.clamping_way,
|
||||
'materials_model_code': self.env['sf.materials.model'].search(
|
||||
[('id', '=', item.materials_model_id.id)]).code,
|
||||
'apply_machine_tool_type_code': self.env['sf.machine_tool.type'].search(
|
||||
[('id', '=', item.type_id.id)]).code,
|
||||
'port_type': item.port_type,
|
||||
'model_file': item.model_file,
|
||||
'length': item.length,
|
||||
'width': item.width,
|
||||
'height': item.height,
|
||||
'weight': item.weight,
|
||||
'clamp_workpiece_length_max': item.state,
|
||||
'clamp_workpiece_width_max': item.clamp_workpiece_width_max,
|
||||
'clamp_workpiece_height_max': item.clamp_workpiece_height_max,
|
||||
'clamp_workpiece_diameter_max': item.clamp_workpiece_diameter_max,
|
||||
'maximum_carrying_weight': item.maximum_carrying_weight,
|
||||
'maximum_clamping_force': item.maximum_clamping_force,
|
||||
'driving_way': item.driving_way,
|
||||
'through_hole_size': item.through_hole_size,
|
||||
'screw_size': item.screw_size,
|
||||
|
||||
}
|
||||
fixture_model_list.append(val)
|
||||
# kw = machine_tool_list
|
||||
kw = json.dumps(fixture_model_list, ensure_ascii=False)
|
||||
r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
ret = r.json()
|
||||
self.code = ret['message']
|
||||
self.state_zc = "已注册"
|
||||
if r == 200:
|
||||
return "注册成功"
|
||||
else:
|
||||
raise ValidationError("没有夹具型号注册信息")
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
from odoo import models, fields, api
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo.exceptions import ValidationError
|
||||
import requests
|
||||
import json
|
||||
|
||||
|
||||
class FunctionalFixtureType(models.Model):
|
||||
@@ -16,7 +20,6 @@ class FunctionalFixture(models.Model):
|
||||
_description = "功能夹具"
|
||||
|
||||
code = fields.Char(string='编码', readonly=True)
|
||||
name = fields.Char(string="名称", size=15, required=True)
|
||||
type_id = fields.Many2one('sf.functional.fixture.type', string="功能夹具类型", required=True)
|
||||
type = fields.Char(related='type_id.name', string="功能夹具类别", store=True)
|
||||
zero_chuck_model_ids = fields.Many2many('sf.fixture.model', 'rel_fixture_model_zero_chuck', string="零点卡盘型号",
|
||||
@@ -34,10 +37,121 @@ class FunctionalFixture(models.Model):
|
||||
vice_tray_model_ids = fields.Many2many('sf.fixture.model', 'rel_fixture_model_vice_tray', string="虎钳托盘型号",
|
||||
domain=[('fixture_material_type', '=', '虎钳托盘')])
|
||||
|
||||
def _get_fixture_model_ids(self, fixture_model_code):
|
||||
fixture_model_ids = []
|
||||
for item in fixture_model_code:
|
||||
fixture_model = self.env['sf.fixture.model'].search([('code', '=', item)])
|
||||
if fixture_model:
|
||||
fixture_model_ids.append(fixture_model.id)
|
||||
return [(6, 0, fixture_model_ids)]
|
||||
@api.onchange('type_id')
|
||||
def _onchange_type_id(self):
|
||||
if self.type_id:
|
||||
functional_fixture_type = self.search(
|
||||
[('type', '=', self.type)], limit=1, order='id desc')
|
||||
if not functional_fixture_type:
|
||||
num = "%04d" % 1
|
||||
else:
|
||||
m = int(functional_fixture_type.code[-3:]) + 1
|
||||
num = "%04d" % m
|
||||
self.code = "%s%s-%s" % ('JKM-C-GNJJ-', self.type_id.code, num)
|
||||
|
||||
_sql_constraints = [
|
||||
('code_uniq', 'unique (code)',
|
||||
'编码不能重复')
|
||||
|
||||
]
|
||||
|
||||
@api.depends('transfer_tray_model_ids', 'pneumatic_tray_model_ids', 'magnetic_tray_model_ids',
|
||||
'vice_tray_model_ids', 'type')
|
||||
def _get_name(self):
|
||||
for record in self:
|
||||
if record.type:
|
||||
if not record.transfer_tray_model_ids and not record.pneumatic_tray_model_ids and not record.magnetic_tray_model_ids and not record.vice_tray_model_ids:
|
||||
record.name = ''
|
||||
if record.transfer_tray_model_ids:
|
||||
for i in record.transfer_tray_model_ids:
|
||||
record.name = '%s%s%s' % (
|
||||
i.display_name.split('-')[0], record.type, '功能夹具')
|
||||
if record.pneumatic_tray_model_ids:
|
||||
for i in record.pneumatic_tray_model_ids:
|
||||
record.name = '%s%s%s' % (
|
||||
i.display_name.split('-')[0], record.type, '功能夹具')
|
||||
if record.magnetic_tray_model_ids:
|
||||
for i in record.magnetic_tray_model_ids:
|
||||
record.name = '%s%s%s' % (
|
||||
i.display_name.split('-')[0], record.type, '功能夹具')
|
||||
if record.vice_tray_model_ids:
|
||||
for i in record.vice_tray_model_ids:
|
||||
record.name = '%s%s%s' % (
|
||||
i.display_name.split('-')[0], record.type, '功能夹具')
|
||||
else:
|
||||
record.name = ''
|
||||
|
||||
name = fields.Char(string="名称", compute=_get_name, readonly=True)
|
||||
|
||||
def _json_zero_chuck_model_item_code(self, item):
|
||||
code_arr = []
|
||||
for i in item.zero_chuck_model_ids:
|
||||
code_arr.append(i.code)
|
||||
return code_arr
|
||||
|
||||
def _json_transfer_tray_model_item_code(self, item):
|
||||
code_arr = []
|
||||
for i in item.transfer_tray_model_ids:
|
||||
code_arr.append(i.code)
|
||||
return code_arr
|
||||
|
||||
def _json_vice_tray_item_code(self, item):
|
||||
code_arr = []
|
||||
for i in item.vice_tray_model_ids:
|
||||
code_arr.append(i.code)
|
||||
return code_arr
|
||||
|
||||
def _json_magnetic_tray_model_item_code(self, item):
|
||||
code_arr = []
|
||||
for i in item.magnetic_tray_model_ids:
|
||||
code_arr.append(i.code)
|
||||
return code_arr
|
||||
|
||||
def _json_pneumatic_tray_model_item_code(self, item):
|
||||
code_arr = []
|
||||
for i in item.pneumatic_tray_model_ids:
|
||||
code_arr.append(i.code)
|
||||
return code_arr
|
||||
|
||||
# 注册到cloud的夹具型号中
|
||||
|
||||
def register_functional_fixture(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
strurl = sf_sync_config['sf_url'] + self.crea_url
|
||||
objs_all = self.search([('code', '=', self.code)])
|
||||
functional_fixture_list = []
|
||||
if objs_all:
|
||||
for item in objs_all:
|
||||
val = {
|
||||
'code': item.code,
|
||||
'factory_token': token,
|
||||
'name': item.name,
|
||||
'code': item.code,
|
||||
'type_code': self.env['sf.functional.fixture.type'].search(
|
||||
[('id', '=', item.type_id.id)]).code,
|
||||
'zero_chuck_model_codes': self.env['sf.functional.fixture']._json_zero_chuck_model_item_code(
|
||||
item),
|
||||
'transfer_tray_model_codes': self.env['sf.functional.fixture']._json_transfer_tray_model_item_code(
|
||||
item),
|
||||
'pneumatic_tray_model_codes': self.env[
|
||||
'sf.functional.fixture']._json_pneumatic_tray_model_item_code(
|
||||
item),
|
||||
'magnetic_tray_model_codes': self.env['sf.functional.fixture']._json_magnetic_tray_model_item_code(
|
||||
item),
|
||||
'vice_tray_model_codes': self.env['sf.functional.fixture']._json_vice_tray_item_code(
|
||||
item),
|
||||
}
|
||||
functional_fixture_list.append(val)
|
||||
# kw = machine_tool_list
|
||||
kw = json.dumps(functional_fixture_list, ensure_ascii=False)
|
||||
r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
ret = r.json()
|
||||
self.code = ret['message']
|
||||
self.state_zc = "已注册"
|
||||
if r == 200:
|
||||
return "功能夹具注册成功"
|
||||
else:
|
||||
raise ValidationError("没有功能夹具注册信息")
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<field name="name">tree.sf.machine.brand</field>
|
||||
<field name="model">sf.machine.brand</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="品牌" create="0" edit="0" delete="0">
|
||||
<tree string="品牌">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="manufacturer_model_number"/>
|
||||
@@ -61,7 +61,7 @@
|
||||
<field name="name">品牌</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.machine.brand</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
#------------------机床型号------------------
|
||||
@@ -81,7 +81,7 @@
|
||||
<field name="name">tree.sf.machine_tool.type</field>
|
||||
<field name="model">sf.machine_tool.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="机床型号" create="0" edit="0" delete="0">
|
||||
<tree string="机床型号" >
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="brand_id"/>
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
<field name="name">夹具型号</field>
|
||||
<field name="model">sf.fixture.model</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="夹具型号" create="0" edit="0" delete="0">
|
||||
<tree string="夹具型号">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="brand_id"/>
|
||||
@@ -175,17 +175,21 @@
|
||||
<field name="name">夹具型号</field>
|
||||
<field name="model">sf.fixture.model</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="夹具型号" create="0" edit="0" delete="0">
|
||||
<form string="夹具型号">
|
||||
<header>
|
||||
<button type="object" class="oe_highlight" name='register_fixture_model' string="机床注册"
|
||||
attrs="{'invisible': [('code','!=',False)]}"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<group string="基本信息">
|
||||
<group>
|
||||
<field name="code" force_save="1"/>
|
||||
<field name="name"/>
|
||||
<field name="brand_id"/>
|
||||
<field name="brand_id" options="{'no_create': True}"/>
|
||||
<field name="manufacturer_model_number"/>
|
||||
<field name="fixture_material_id"/>
|
||||
<field name="fixture_material_id" options="{'no_create': True}"/>
|
||||
<field name="fixture_material_type" invisible="1"/>
|
||||
<field name="multi_mounting_type_id"/>
|
||||
<field name="multi_mounting_type_id" options="{'no_create': True}"/>
|
||||
</group>
|
||||
<group>
|
||||
<!-- <field name="upload_model_file" widget="many2many_binary"/>-->
|
||||
@@ -232,7 +236,7 @@
|
||||
<field name="maximum_clamping_force"></field>
|
||||
</group>
|
||||
<group>
|
||||
<field name="materials_model_id"/>
|
||||
<field name="materials_model_id" options="{'no_create': True}"/>
|
||||
<field name="clamping_way"
|
||||
attrs='{"invisible": [("fixture_material_type","not in",("气动托盘","磁吸托盘","虎钳托盘"))]}'/>
|
||||
<field name="port_type"
|
||||
@@ -243,7 +247,7 @@
|
||||
attrs='{"invisible": [("fixture_material_type","!=",("转接板(锁板)托盘"))]}'/>
|
||||
<field name="driving_way"
|
||||
attrs='{"invisible": [("fixture_material_type","not in",("虎钳托盘","零点卡盘"))]}'/>
|
||||
<field name="apply_machine_tool_type_id"
|
||||
<field name="apply_machine_tool_type_ids" widget="many2many_tags" options="{'no_create': True}"
|
||||
attrs='{"invisible": [("fixture_material_type","!=",("零点卡盘"))]}'/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
<field name="name">功能夹具</field>
|
||||
<field name="model">sf.functional.fixture</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="功能夹具" create="0" edit="0" delete="0">
|
||||
<tree string="功能夹具">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="type_id"/>
|
||||
@@ -93,7 +93,7 @@
|
||||
<field name="name">功能夹具</field>
|
||||
<field name="model">sf.functional.fixture</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="功能夹具" create="0" edit="0" delete="0">
|
||||
<form string="功能夹具">
|
||||
<sheet>
|
||||
<group string="基本信息">
|
||||
<group>
|
||||
@@ -101,15 +101,19 @@
|
||||
<field name="name"/>
|
||||
<field name="type_id"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="zero_chuck_model_ids" widget="many2many_tags"/>
|
||||
<field name="zero_chuck_model_ids" widget="many2many_tags" options="{'no_create': True}"/>
|
||||
<field name="transfer_tray_model_ids" widget="many2many_tags"
|
||||
attrs="{'invisible': [('type', '!=', '转接板(锁板)式')]}"/>
|
||||
options="{'no_create': True}"
|
||||
attrs='{"invisible": [("type","!=","转接板(锁板)式")],"required": [("type", "=", "转接板(锁板)式")]}'/>
|
||||
<field name="pneumatic_tray_model_ids" widget="many2many_tags"
|
||||
attrs="{'invisible': [('type', '!=', '气动式')]}"/>
|
||||
options="{'no_create': True}"
|
||||
attrs='{"invisible": [("type","!=","气动式")],"required": [("type", "=", "气动式")]}'/>
|
||||
<field name="magnetic_tray_model_ids" widget="many2many_tags"
|
||||
attrs="{'invisible': [('type', '!=', '磁吸式')]}"/>
|
||||
options="{'no_create': True}"
|
||||
attrs='{"invisible": [("type","!=","磁吸式")],"required": [("type", "=", "磁吸式")]}'/>
|
||||
<field name="vice_tray_model_ids" widget="many2many_tags"
|
||||
attrs="{'invisible': [('type', '!=', '虎钳式')]}"/>
|
||||
options="{'no_create': True}"
|
||||
attrs='{"invisible": [("type","!=","虎钳式")],"required": [("type", "=", "虎钳式")]}'/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
|
||||
@@ -278,7 +278,7 @@
|
||||
attrs='{"invisible": [("fixture_material_type","!=",("转接板(锁板)托盘"))]}'/>
|
||||
<field name="fixture_driving_way"
|
||||
attrs='{"invisible": [("fixture_material_type","not in",("虎钳托盘","零点卡盘"))]}'/>
|
||||
<field name="fixture_apply_machine_tool_type_id"
|
||||
<field name="fixture_apply_machine_tool_type_ids"
|
||||
attrs='{"invisible": [("fixture_material_type","!=",("零点卡盘"))]}'/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -147,7 +147,8 @@ class ResProductMo(models.Model):
|
||||
fixture_maximum_carrying_weight = fields.Float(string="最大承载重量[kg]", digits=(16, 4))
|
||||
fixture_maximum_clamping_force = fields.Integer(string="最大夹持力[n]", size=8)
|
||||
fixture_driving_way = fields.Char(string="驱动方式")
|
||||
fixture_apply_machine_tool_type_id = fields.Many2one('sf.machine_tool.type', string="适用机床型号")
|
||||
fixture_apply_machine_tool_type_ids = fields.Many2many('sf.machine_tool.type', 'rel_product_machine_tool_type',
|
||||
string="适用机床型号")
|
||||
fixture_through_hole_size = fields.Integer(string="过孔大小[mm]", size=6)
|
||||
fixture_screw_size = fields.Integer(string="螺牙大小[mm]", size=6)
|
||||
|
||||
@@ -205,7 +206,7 @@ class ResProductMo(models.Model):
|
||||
item.fixture_clamp_workpiece_width_max = item.fixture_model_id.clamp_workpiece_width_max
|
||||
item.fixture_clamp_workpiece_height_max = item.fixture_model_id.clamp_workpiece_height_max
|
||||
item.fixture_clamp_workpiece_diameter_max = item.fixture_model_id.clamp_workpiece_diameter_max
|
||||
item.fixture_apply_machine_tool_type_id = item.fixture_model_id.apply_machine_tool_type_id.id
|
||||
item.fixture_apply_machine_tool_type_id = self._get_ids(item.fixture_model_id.apply_machine_tool_type_ids)
|
||||
|
||||
@api.onchange('cutting_tool_model_id')
|
||||
def _onchange_cutting_tool_model_id(self):
|
||||
|
||||
Reference in New Issue
Block a user