Accept Merge Request #353: (feature/修改机床参数bug -> develop)

Merge Request: 修改设备table,品牌图片改成图片

Created By: @龚启豪
Accepted By: @龚启豪
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/353?initial=true
This commit is contained in:
龚启豪
2023-08-29 15:50:08 +08:00
committed by Coding
3 changed files with 37 additions and 25 deletions

View File

@@ -35,7 +35,7 @@ class MachineBrand(models.Model):
code = fields.Char('编码') code = fields.Char('编码')
name = fields.Char('名称') name = fields.Char('名称')
tag_ids = fields.Many2many('sf.machine.brand.tags', 'rel_machine_brand_tags', string='类别') tag_ids = fields.Many2many('sf.machine.brand.tags', 'rel_machine_brand_tags', string='类别')
image_brand = fields.Image("品牌图片") image_brand = fields.Image("图片")
remark = fields.Text('备注') remark = fields.Text('备注')
active = fields.Boolean('有效', default=True) active = fields.Boolean('有效', default=True)

View File

@@ -171,12 +171,7 @@
</page> </page>
<page string="其他" attrs="{'invisible': [('type_id', '=', False)]}">
<group string="其他">
<field name="remark"/>
</group>
<button type="object" class="oe_highlight" name='enroll_machine_tool' string="机床注册"/>
</page>
</xpath> </xpath>
@@ -206,6 +201,23 @@
<field name='equipment_maintenance_standards_ids' widget="many2many_tags" invisible="1"/> <field name='equipment_maintenance_standards_ids' widget="many2many_tags" invisible="1"/>
</xpath> </xpath>
<xpath expr="//page[@name='description']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//page[@name='product_information']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//page[@name='maintenance']" position="after">
<page string="其他" attrs="{'invisible': [('type_id', '=', False)]}">
<group string="其他">
<field name="remark"/>
</group>
<button type="object" class="oe_highlight" name='enroll_machine_tool' string="机床注册"/>
</page>
</xpath>
</data> </data>
</field> </field>
</record> </record>
@@ -286,7 +298,7 @@
</xpath> </xpath>
<xpath expr="//templates" position="inside"> <xpath expr="//templates" position="inside">
<t t-name="kanban-box"> <t t-name="kanban-box">
<div t-attf-class="oe_kanban_global_click o_kanban_record_has_image_fill o_hr_kanban_record oe_kanban_card oe_kanban_global_click"> <div t-attf-class="oe_kanban_global_click o_kanban_record_has_image_fill o_hr_kanban_record oe_kanban_card oe_kanban_global_click">
@@ -303,7 +315,7 @@
<div class="o_kanban_record_bottom state_zc"> <div class="o_kanban_record_bottom state_zc">
<field name="state_zc"/> <field name="state_zc"/>
</div> </div>
<div class="o_kanban_record_bottom state_zc"> <div class="o_kanban_record_bottom state_zc">
<field name="technician_user_id"/> <field name="technician_user_id"/>
</div> </div>
<div class="o_kanban_record_bottom state_zc" <div class="o_kanban_record_bottom state_zc"

View File

@@ -1,8 +1,8 @@
from odoo import models, fields, api from odoo import models, fields, api
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
from odoo.modules import get_resource_path from odoo.modules import get_resource_path
# from OCC.Extend.DataExchange import read_step_file from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file from OCC.Extend.DataExchange import write_stl_file
import logging import logging
import base64 import base64
import hashlib import hashlib
@@ -566,20 +566,20 @@ class ResProductMo(models.Model):
item.model_file = self.transition_glb_file(report_path, model_code) item.model_file = self.transition_glb_file(report_path, model_code)
# 将attach的datas内容转为glb文件 # 将attach的datas内容转为glb文件
# def transition_glb_file(self, report_path, code): def transition_glb_file(self, report_path, code):
# shapes = read_step_file(report_path) shapes = read_step_file(report_path)
# output_file = os.path.join('/tmp', str(code) + '.stl') output_file = os.path.join('/tmp', str(code) + '.stl')
# write_stl_file(shapes, output_file, 'binary', 0.03, 0.5) write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
# # 转化为glb # 转化为glb
# output_glb_file = os.path.join('/tmp', str(code) + '.glb') output_glb_file = os.path.join('/tmp', str(code) + '.glb')
# util_path = get_resource_path('sf_dlm', 'static/util') util_path = get_resource_path('sf_dlm', 'static/util')
# cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file) cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
# os.system(cmd) os.system(cmd)
# # 转base64 # 转base64
# with open(output_glb_file, 'rb') as fileObj: with open(output_glb_file, 'rb') as fileObj:
# image_data = fileObj.read() image_data = fileObj.read()
# base64_data = base64.b64encode(image_data) base64_data = base64.b64encode(image_data)
# return base64_data return base64_data
class ResMrpBomMo(models.Model): class ResMrpBomMo(models.Model):