Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/刀具管理加粗字段调整及界面布局优化

This commit is contained in:
yuxianghui
2023-08-23 17:32:58 +08:00
11 changed files with 74 additions and 50 deletions

View File

@@ -256,7 +256,7 @@ class MachineToolType(models.Model):
name = fields.Char('名称')
brand_id = fields.Many2one('sf.machine.brand', string='品牌')
knife_type = fields.Selection(
[("BT40", "BT40"), ("BT30", "BT30")],
[("BT40", "BT40"), ("BT30", "BT30"), ("BT50", "BT50")],
default="", string="刀把类型")
number_of_knife_library = fields.Integer('刀库数量')
rotate_speed = fields.Integer('转速')
@@ -308,6 +308,13 @@ class MachineToolType(models.Model):
active = fields.Boolean('有效', default=True)
code = fields.Char('编码')
def _get_ids(self, machine_tool_type_code):
machine_tool_type_ids = []
for item in machine_tool_type_code:
machine_tool_type = self.search([('code', '=', item)])
machine_tool_type_ids.append(machine_tool_type.id)
return [(6, 0, machine_tool_type_ids)]
class MachineToolCategory(models.Model):
_name = 'sf.machine_tool.category'

View File

@@ -53,5 +53,10 @@ class FixtureModel(models.Model):
screw_size = fields.Integer(string="螺牙大小[mm]", size=6)
active = fields.Boolean('有效', default=True)
# @api.model
# def create(self, vals):
# obj = super(FixtureModel, self).create(vals)
# return obj

View File

@@ -30,6 +30,7 @@
<field name="name"/>
<field name="tag_ids" widget="many2many_tags" optional="hide"/>
<field name="remark"/>
<field name="image_brand" widget="image"/>
</tree>
</field>
</record>
@@ -41,16 +42,16 @@
<form string="品牌" create="0" edit="0" delete="1">
<sheet>
<!-- <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>-->
<field name="image_brand" widget='image' class="oe_avatar"
options="{'preview_image': 'image_128'}" string="log"/>
<div class="oe_title">
<h1>
<field name="code" readonly="1"/>
<field name="name" readonly="1"/>
</h1>
<field name="image_brand" widget='image' class="oe_avatar"
options="{'preview_image': 'image_128'}" string="log"/>
</div>
<group>
<group>
<field name="name" string="名称"/>
<field name="code"/>
<field name="tag_ids"
widget="many2many_tags"
options="{'color_field': 'color', 'no_create_edit': True}"
@@ -108,15 +109,15 @@
<sheet>
<div class="oe_title">
<h1>
<field name="code"/>
<field name="name" placeholder="e.g. LED Monitor"/>
</h1>
</div>
<group>
<group>
<label for="name"/>
<h1>
<field name="name" string="设备名称" placeholder="e.g. LED Monitor"/>
</h1>
<!-- <label for="name"/>-->
<!-- <h1>-->
<!-- <field name="name" string="设备名称" placeholder="e.g. LED Monitor"/>-->
<!-- </h1>-->
<field name="code" force_save="1" readonly="1"/>
<field name="brand_id" required="1"
domain="[('tag_ids', '=', '机床')]"
@@ -363,7 +364,7 @@
<sheet>
<div class="oe_title">
<h1>
<field name="MTcode"/>
<field name="name" placeholder="e.g. LED Monitor"/>
</h1>
</div>
<group string="基本信息">
@@ -374,7 +375,7 @@
<!-- options="{'no_create': True}"/>-->
<!-- </group>-->
<group>
<field name="name" required="1" string="设备名称" placeholder="e.g. LED Monitor"/>
<field name="MTcode" required="1"/>
<field name="type_id" required="1" options="{'no_create': True}"
domain="[('brand_id', '=', brand_id)]"
attrs="{'invisible': [('brand_id','=',False)]}"/>

View File

@@ -49,7 +49,7 @@
<sheet>
<div class="oe_title">
<h1>
<field name="code"/>
<field name="name" required="1"/>
</h1>
</div>
<group>
@@ -57,7 +57,7 @@
<field name="sequence"/>
</group>
<group>
<field name="name" required="1"/>
<field name="code" force_save="1" readonly="1"/>
</group>
</group>
<notebook>
@@ -119,12 +119,12 @@
<sheet>
<div class="oe_title">
<h1>
<field name="process_encode"/>
<field name="name" required="1"/>
</h1>
</div>
<group>
<group>
<field name="name" required="1" string="名称"/>
<field name="process_encode"/>
</group>
<notebook>
<page string="可选参数">
@@ -199,12 +199,12 @@
<sheet>
<div class="oe_title">
<h1>
<field name="materials_no" readonly="1" force_save="1"/>
<field name="name" readonly="1"/>
</h1>
</div>
<group>
<group>
<field name="name" readonly="1"/>
<field name="materials_no" readonly="1" force_save="1"/>
<field name="gain_way" required="1"/>
<field name="tensile_strength" required="1"/>
<field name="hardness" required="1"/>
@@ -278,12 +278,12 @@
<sheet>
<div class="oe_title">
<h1>
<field name="materials_no"/>
<field name="name" required="1"/>
</h1>
</div>
<group>
<group>
<field name="name" required="1" string="名称"/>
<field name="materials_no"/>
</group>
<notebook>
<page string="型号">

View File

@@ -163,7 +163,7 @@
<field name="name">夹具型号</field>
<field name="model">sf.fixture.model</field>
<field name="arch" type="xml">
<tree string="夹具型号">
<tree string="夹具型号" create="0" edit="0" delete="1">
<field name="code"/>
<field name="name" string="名称"/>
<field name="brand_id"/>
@@ -177,16 +177,16 @@
<field name="name">夹具型号</field>
<field name="model">sf.fixture.model</field>
<field name="arch" type="xml">
<form string="夹具型号">
<form string="夹具型号" create="0" edit="0" delete="1" >
<sheet>
<div class="oe_title">
<h1>
<field name="code" force_save="1" readonly="1"/>
<field name="name" />
</h1>
</div>
<group>
<group>
<field name="name" string="名称"/>
<field name="code" force_save="1" readonly="1"/>
<field name="fixture_material_id" options="{'no_create': True}"/>
<field name="fixture_material_type" invisible="1"/>
<field name="multi_mounting_type_id" options="{'no_create': True}"/>

View File

@@ -103,12 +103,12 @@
<sheet>
<div class="oe_title">
<h1>
<field name="code"/>
<field name="name"/>
</h1>
</div>
<group string="基本信息">
<group>
<field name="name" string="名称"/>
<field name="code" />
<field name="type_id"/>
<field name="type" invisible="1"/>
<field name="zero_chuck_model_ids" widget="many2many_tags" options="{'no_create': True}"/>

View File

@@ -214,12 +214,12 @@
<sheet>
<div class="oe_title">
<h1>
<field name="code"/>
<field name="name" placeholder="e.g. LED Monitor"/>
</h1>
</div>
<group>
<group>
<field name="name" string="名称"/>
<field name="code" />
<field name="cutting_tool_material_id"
options="{'no_create': True, 'no_quick_create': True}"/>
<field name="cutting_tool_type" invisible="1"/>

View File

@@ -21,7 +21,7 @@
<notebook>
<page string="维保标准" attrs="{'invisible': [('equipment_maintenance_id', '=', False)]}">
<field name="maintenance_standards" widget="ony2many">
<tree create="False">
<tree editable="bottom">
<field name="name"/>
<field name="maintenance_standards"/>
</tree>

View File

@@ -569,15 +569,20 @@ class MachineBrand(models.Model):
result = json.loads(r['result'])
if result['status'] == 1:
for item in result['machine_brand_all_list']:
brand = self.env['sf.machine.brand'].search(
[("code", '=', item['code'])])
if not brand:
if item.get('image_brand'):
image = base64.b64decode(item['image_brand'])
else:
image = ''
self.env['sf.machine.brand'].create({
"id": item['id'],
"name": item['name'],
"code": item['code'],
"remark": item['remark'],
"image_brand": '' if not item['image_brand'] else base64.b64encode(item.image_brand),
"image_brand": image,
"tag_ids": self.env['sf.machine.brand.tags'].search(
[("name", 'in', item['tag_ids'])]).ids
})
@@ -1519,10 +1524,11 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],
})
else:
fixture_model.write({
@@ -1548,10 +1554,11 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],
})
else:
raise ValidationError("认证未通过")
@@ -1599,10 +1606,11 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],
})
else:
fixture_model.write({
@@ -1628,8 +1636,8 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -19,31 +19,34 @@ var QWeb = core.qweb;
import { Component, onWillUpdateProps, useState, useRef, useEffect } from "@odoo/owl";
export class StepViewer extends Component {
setup() {
console.log('setup')
setup() {
this.props.url = this.formatUrl();
}
formatUrl(){
var url = '';
if (this.props.value) {
if (utils.is_bin_size(this.props.value)) {
if (this.props.value.slice(-1) == 'b' && !isNaN(this.props.value.split(' ')[0])) {
var url_props = {
base_url: session['web.base.url'],
model: this.props.record.resModel,
id: JSON.stringify(this.props.record.data['id']),
field: this.props.name}
url = url_props['base_url']+'/web/content/'+url_props['model']+'/'+url_props['id']+'/'+url_props['field']+'?download=true'
console.log('url', url)
url = url_props['base_url'].replace('http://', 'https://') +'/web/content/'+url_props['model']+'/'+url_props['id']+'/'+url_props['field']+'?download=true'
// url = 'http://localhost:8069'+'/web/content/'+url_props['model']+'/'+url_props['id']+'/'+url_props['field']+'?download=true'
console.log('url111111',url)
return url
} else {
url = "data:model/gltf-binary;base64," + this.props.value;
console.log('url222', url)
url = "data:model/gltf-binary;base64," + this.props.value;
console.log('url2',url)
return url
// localStorage.setItem('url',url)
// let new_url = localStorage.getItem(('url'))
// var oViewer = document.getElementsByTagName('model-viewer')[0];
// return new_url
// url = "web_widget_model_viewer/static/src/images/not_model.png";
}
}
return url
}
}
}
StepViewer.template = "web_widget_model_viewer.BinaryField3d";