Accept Merge Request #202: (feature/功能刀具页面 -> develop)
Merge Request: 处理bug Created By: @龚启豪 Accepted By: @龚启豪 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/202?initial=true
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
'web.assets_qweb': [
|
||||
],
|
||||
'web.assets_backend': [
|
||||
'sf_base/static/src/scss/format_img.scss',
|
||||
'sf_base/static/src/scss/*.scss',
|
||||
],
|
||||
|
||||
},
|
||||
|
||||
@@ -85,7 +85,7 @@ class MachineTool(models.Model):
|
||||
[("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")],
|
||||
default='正常', string="机床状态")
|
||||
#0606新增字段
|
||||
machine_tool_picture = fields.Binary('机床图片')
|
||||
machine_tool_picture = fields.Binary('图片')
|
||||
heightened_way = fields.Selection([
|
||||
('sifudianji', '伺服电机驱动'),
|
||||
('youyagang', '油压缸驱动'),
|
||||
@@ -260,7 +260,7 @@ class MachineToolType(models.Model):
|
||||
rotate_speed = fields.Integer('转速')
|
||||
#0606新增字段
|
||||
created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
||||
machine_tool_picture = fields.Binary('机床图片')
|
||||
machine_tool_picture = fields.Binary('图片')
|
||||
heightened_way = fields.Selection([
|
||||
('sifudianji', '伺服电机驱动'),
|
||||
('youyagang', '油压缸驱动'),
|
||||
|
||||
7
sf_base/static/src/scss/test.scss
Normal file
7
sf_base/static/src/scss/test.scss
Normal file
@@ -0,0 +1,7 @@
|
||||
.test_model {
|
||||
display: flex !important;
|
||||
}
|
||||
.test_model>.o_form_label {
|
||||
margin-left: 20px;
|
||||
margin-right: 0px !important;
|
||||
}
|
||||
@@ -96,23 +96,25 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="form_sf_machine_tool_type">
|
||||
<record model="ir.ui.view" id="form_sf_machine_tool_type">
|
||||
<field name="name">form.sf.machine_tool.type</field>
|
||||
<field name="model">sf.machine_tool.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="机床型号">
|
||||
<field name="machine_tool_picture" widget="image"/>
|
||||
|
||||
<group string="基本信息">
|
||||
<group>
|
||||
<field name="code" force_save="1" readonly="1"/>
|
||||
<field name="name" required="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="machine_tool_category"/>
|
||||
<field name="machine_tool_category" required="1"/>
|
||||
<field name="brand_id" required="1"
|
||||
domain="[('tag_ids', '=', '机床')]"
|
||||
options="{'no_create': True}" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="machine_tool_picture" widget="image" nolabel="1"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
<group string="参数">
|
||||
<group>
|
||||
@@ -177,6 +179,7 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_sf_machine_tool_type" model="ir.actions.act_window">
|
||||
<field name="name">机床型号</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
@@ -249,7 +252,7 @@
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
[机床型号] 还没有哦!点左上角的[创建]按钮,沙发归你了!
|
||||
[机床类型] 还没有哦!点左上角的[创建]按钮,沙发归你了!
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
|
||||
@@ -53,10 +53,26 @@
|
||||
<field name="model">sf.functional.cutting.tool</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="功能刀具">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="functional_model_number"/>
|
||||
<field name="image" widget='image'/>
|
||||
<field name="code" />
|
||||
<field name="name" />
|
||||
<field name="functional_model_number" />
|
||||
<field name="integral_model_number"/>
|
||||
<field name="blade_model_number" optional="hide"/>
|
||||
<field name="cutterbar_model_number" optional="hide"/>
|
||||
<field name="cutterpad_model_number" optional="hide"/>
|
||||
<field name="handle_model_number" optional="hide"/>
|
||||
<field name="chuck_model_number" optional="hide"/>
|
||||
<field name="diameter" optional="show"/>
|
||||
<field name="tool_grade" optional="show"/>
|
||||
<field name="machining_accuracy" optional="hide"/>
|
||||
<field name="tool_length" optional="show"/>
|
||||
<field name="blade_number" optional="show"/>
|
||||
<field name="integral_blade_length" optional="show"/>
|
||||
<field name="effective_blade_length" optional="show"/>
|
||||
<field name="max_life" optional="show"/>
|
||||
<field name="is_standard" optional="show"/>
|
||||
<field name="applicable_range" optional="show"/>
|
||||
<field name="image" widget='image' optional="show"/>
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from odoo import models, fields, api
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.modules import get_resource_path
|
||||
from OCC.Extend.DataExchange import read_step_file
|
||||
from OCC.Extend.DataExchange import write_stl_file
|
||||
# from OCC.Extend.DataExchange import read_step_file
|
||||
# from OCC.Extend.DataExchange import write_stl_file
|
||||
import logging
|
||||
import base64
|
||||
import hashlib
|
||||
@@ -468,20 +468,20 @@ class ResProductTemplate(models.Model):
|
||||
item.model_file = self.transition_glb_file(report_path, model_code)
|
||||
|
||||
# 将attach的datas内容转为glb文件
|
||||
def transition_glb_file(self, report_path, code):
|
||||
shapes = read_step_file(report_path)
|
||||
output_file = os.path.join('/tmp', str(code) + '.stl')
|
||||
write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
|
||||
# 转化为glb
|
||||
output_glb_file = os.path.join('/tmp', str(code) + '.glb')
|
||||
util_path = get_resource_path('sf_dlm', '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
|
||||
# def transition_glb_file(self, report_path, code):
|
||||
# shapes = read_step_file(report_path)
|
||||
# output_file = os.path.join('/tmp', str(code) + '.stl')
|
||||
# write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
|
||||
# # 转化为glb
|
||||
# output_glb_file = os.path.join('/tmp', str(code) + '.glb')
|
||||
# util_path = get_resource_path('sf_dlm', '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
|
||||
|
||||
@api.onchange('integral_cutting_tool_type_id')
|
||||
def _get_integral_cutting_tool_type_info(self):
|
||||
|
||||
@@ -58,6 +58,29 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
total = fields.Text(string='总计')
|
||||
# remark = fields.Text(string='备注/说明')
|
||||
|
||||
# @api.onchange('functional_cutting_tool_id')
|
||||
# def get_functional_cutting_tool_info(self):
|
||||
# for item in self:
|
||||
# item.code = item.functional_cutting_tool_id.code,
|
||||
# item.name = item.functional_cutting_tool_id.name,
|
||||
# item.functional_model_number = item.functional_cutting_tool_id.functional_model_number,
|
||||
# item.integral_model_number = item.functional_cutting_tool_id.integral_model_number,
|
||||
# item.blade_model_number = item.functional_cutting_tool_id.blade_model_number,
|
||||
# item.cutterbar_model_number = item.functional_cutting_tool_id.cutterbar_model_number,
|
||||
# item.cutterpad_model_number = item.functional_cutting_tool_id.cutterpad_model_number,
|
||||
# item.handle_model_number = item.functional_cutting_tool_id.handle_model_number,
|
||||
# item.chuck_model_number = item.functional_cutting_tool_id.chuck_model_number,
|
||||
# item.diameter = item.functional_cutting_tool_id.diameter,
|
||||
# item.tool_grade = item.functional_cutting_tool_id.tool_grade,
|
||||
# item.machining_accuracy = item.functional_cutting_tool_id.machining_accuracy,
|
||||
# item.ctool_lengthode = item.functional_cutting_tool_id.tool_length,
|
||||
# item.blade_number = item.functional_cutting_tool_id.blade_number,
|
||||
# item.integral_blade_length = item.functional_cutting_tool_id.integral_blade_length,
|
||||
# item.effective_blade_length = item.functional_cutting_tool_id.effective_blade_length,
|
||||
# item.max_life = item.functional_cutting_tool_id.max_life,
|
||||
# item.is_standard = item.functional_cutting_tool_id.is_standard,
|
||||
# item.applicable_range = item.functional_cutting_tool_id.applicable_range,
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
parent="menu_sf_tool_manage"
|
||||
name="功能刀具列表"
|
||||
sequence="3"
|
||||
action="sf_base.action_sf_functional_cutting_tool"
|
||||
action="sf_function_tool_entry_list_view_act"
|
||||
/>
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
id="menu_sf_functional_cutting_tool_warning"
|
||||
parent="menu_sf_tool_manage"
|
||||
name="功能刀具预警"
|
||||
sequence="3"
|
||||
action="action_sf_functional_cutting_tool_warning"
|
||||
sequence="4"
|
||||
action="sf_function_tool_entry_warning_view_act"
|
||||
/>
|
||||
|
||||
<menuitem
|
||||
|
||||
@@ -1,6 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- 功能刀具列表tree view -->
|
||||
<record id="view_functional_cutting_tool_list_tree" model="ir.ui.view">
|
||||
<field name="name">sf.functional.cutting.tool.entity.list.tree</field>
|
||||
<field name="model">sf.functional.cutting.tool.entity</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="功能刀具">
|
||||
<field name="code" />
|
||||
<field name="name" />
|
||||
<field name="functional_model_number" />
|
||||
<field name="integral_model_number"/>
|
||||
<field name="blade_model_number" optional="hide"/>
|
||||
<field name="cutterbar_model_number" optional="hide"/>
|
||||
<field name="cutterpad_model_number" optional="hide"/>
|
||||
<field name="handle_model_number" optional="hide"/>
|
||||
<field name="chuck_model_number" optional="hide"/>
|
||||
<field name="diameter" optional="show"/>
|
||||
<field name="tool_grade" optional="show"/>
|
||||
<field name="machining_accuracy" optional="hide"/>
|
||||
<field name="tool_length" optional="show"/>
|
||||
<field name="blade_number" optional="show"/>
|
||||
<field name="integral_blade_length" optional="show"/>
|
||||
<field name="effective_blade_length" optional="show"/>
|
||||
<field name="max_life" optional="show"/>
|
||||
<field name="is_standard" optional="show"/>
|
||||
<field name="applicable_range" optional="show"/>
|
||||
<field name="image" widget='image' optional="show"/>
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_function_tool_entry_list_view_act" model="ir.actions.act_window">
|
||||
<field name="name">功能刀具列表</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.functional.cutting.tool.entity</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_functional_cutting_tool_list_tree"/>
|
||||
</record>
|
||||
|
||||
<!-- 功能刀具预警tree view -->
|
||||
<record id="view_functional_cutting_tool_warning_tree" model="ir.ui.view">
|
||||
<field name="name">sf.functional.cutting.tool.entity.tree</field>
|
||||
@@ -36,6 +75,14 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_function_tool_entry_warning_view_act" model="ir.actions.act_window">
|
||||
<field name="name">功能刀具预警</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.functional.cutting.tool.entity</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_functional_cutting_tool_warning_tree"/>
|
||||
</record>
|
||||
|
||||
<!-- ========================================功能刀具出入库记录================================================================== -->
|
||||
<record id="sf_function_tool_entry_exit_records_view_tree" model="ir.ui.view">
|
||||
<field name="name">功能刀具出入库记录</field>
|
||||
|
||||
Reference in New Issue
Block a user