Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修改机床参数bug
This commit is contained in:
0
jikimo_frontend/__init__.py
Normal file
0
jikimo_frontend/__init__.py
Normal file
33
jikimo_frontend/__manifest__.py
Normal file
33
jikimo_frontend/__manifest__.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': '机企猫智能工厂 样式调整',
|
||||
'version': '1.0',
|
||||
'summary': '机企猫智能工厂 样式调整',
|
||||
'sequence': 1,
|
||||
'description': """
|
||||
在本模块,定义了样式的修改
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': [],
|
||||
'data': [
|
||||
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
'assets': {
|
||||
|
||||
'web.assets_qweb': [
|
||||
],
|
||||
'web.assets_backend': [
|
||||
'jikimo_frontend/static/src/fields/custom_many2many_checkboxes/*',
|
||||
'jikimo_frontend/static/src/scss/custom_style.scss',
|
||||
],
|
||||
|
||||
},
|
||||
'license': 'LGPL-3',
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': False,
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
.zoomed {
|
||||
position: fixed !important;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) scale(10);
|
||||
}
|
||||
|
||||
.many2many_flex {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.many2many_flex>div {
|
||||
margin-right: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.many2many_flex>div>:nth-child(2) {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.close {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
top: -8.8px;
|
||||
right: -8.8px;
|
||||
color: #fff;
|
||||
background-color: #000;
|
||||
opacity: 0;
|
||||
text-align: center;
|
||||
line-height: 20px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.img_close {
|
||||
opacity: 1;
|
||||
transform: scale(0.1);
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import {Many2ManyCheckboxesField} from "@web/views/fields/many2many_checkboxes/many2many_checkboxes_field";
|
||||
import {registry} from "@web/core/registry";
|
||||
|
||||
export class MyCustomWidget extends Many2ManyCheckboxesField {
|
||||
// 你可以重写或者添加一些方法和属性
|
||||
// 例如,你可以重写setup方法来添加一些事件监听器或者初始化一些变量
|
||||
setup() {
|
||||
super.setup(); // 调用父类的setup方法
|
||||
// 你自己的代码
|
||||
}
|
||||
|
||||
onImageClick(event) {
|
||||
// 放大图片逻辑
|
||||
// 获取图片元素
|
||||
const img = event.target;
|
||||
const close = img.nextSibling
|
||||
|
||||
// 实现放大图片逻辑
|
||||
// 比如使用 CSS 放大
|
||||
img.parentElement.classList.add('zoomed');
|
||||
close.classList.add('img_close')
|
||||
}
|
||||
|
||||
onCloseClick(event) {
|
||||
const close = event.target;
|
||||
const img = close.previousSibling
|
||||
img.parentElement.classList.remove('zoomed')
|
||||
close.classList.remove('img_close')
|
||||
}
|
||||
}
|
||||
|
||||
MyCustomWidget.template = "sf_plan.MyCustomWidget"
|
||||
// MyCustomWidget.supportedTypes = ['many2many'];
|
||||
|
||||
registry.category("fields").add("custom_many2many_checkboxes", MyCustomWidget);
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="sf_plan.MyCustomWidget" owl="1">
|
||||
<div aria-atomic="true" class="many2many_flex">
|
||||
<t t-foreach="items" t-as="item" t-key="item[0]">
|
||||
<div>
|
||||
<CheckBox
|
||||
value="isSelected(item)"
|
||||
disabled="props.readonly"
|
||||
onChange="(ev) => this.onChange(item[0], ev)"
|
||||
>
|
||||
<t t-esc="item[1]"/>
|
||||
|
||||
</CheckBox>
|
||||
<div t-on-dblclick="onImageClick">
|
||||
<t>
|
||||
<img t-att-src="item[2]" width="50" height="50"/>
|
||||
<div class="close" t-on-click="onCloseClick">×</div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
151
jikimo_frontend/static/src/scss/custom_style.scss
Normal file
151
jikimo_frontend/static/src/scss/custom_style.scss
Normal file
@@ -0,0 +1,151 @@
|
||||
.test_model {
|
||||
display: flex !important;
|
||||
}
|
||||
|
||||
.test_model > .o_form_label {
|
||||
margin-left: 20px;
|
||||
margin-right: 0px !important;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
div:has(.o_required_modifier) > label::before {
|
||||
content: '*' !important;
|
||||
color: red !important;
|
||||
padding: 0 4px !important;
|
||||
vertical-align: top !important;
|
||||
font-size: 1.5rem !important;
|
||||
}
|
||||
|
||||
.my-image div {
|
||||
width: 110px !important;
|
||||
height: 110px !important;
|
||||
}
|
||||
|
||||
.add_flex {
|
||||
padding: 5px 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.maintenance_name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.o_kanban_renderer .o_kanban_record .o_kanban_record_has_image_fill .o_kanban_image_fill_left {
|
||||
flex: unset !important;
|
||||
}
|
||||
|
||||
.o_kanban_renderer .o_kanban_record .o_kanban_record_bottom {
|
||||
margin-top: 5px;
|
||||
display: inline !important;
|
||||
}
|
||||
|
||||
td.o_required_modifier {
|
||||
display: table-cell !important;
|
||||
}
|
||||
|
||||
.show_state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 8px;
|
||||
margin: auto;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.show_state > div {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border: 1px solid #000
|
||||
}
|
||||
|
||||
.show_state > div:nth-child(2) {
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.oe_kanban_card.kanban_color_2 {
|
||||
background-color: #FF4343 !important;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.oe_kanban_card.kanban_color_1 {
|
||||
background-color: #27FEA9 !important;
|
||||
opacity: 0.7;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.oe_kanban_card.kanban_color_3 {
|
||||
background-color: rgb(255, 150, 0) !important;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.my-image img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.color_1 {
|
||||
background-color: #27FEA9;
|
||||
}
|
||||
|
||||
.color_2 {
|
||||
background-color: #FF4343;
|
||||
}
|
||||
|
||||
.color_3 {
|
||||
background-color: rgb(255, 150, 0);
|
||||
}
|
||||
|
||||
.font_color_1 {
|
||||
color: rgb(0, 183, 0);
|
||||
}
|
||||
|
||||
.font_color_2 {
|
||||
color: #FF4343;
|
||||
}
|
||||
|
||||
.font_color_3 {
|
||||
color: rgb(255, 150, 0);
|
||||
}
|
||||
|
||||
.o_kanban_card_header_title {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.o_kanban_record_bottom {
|
||||
font-family: '华文中宋';
|
||||
//font-weight: bold;
|
||||
}
|
||||
|
||||
.text-truncate {
|
||||
overflow: unset !important;
|
||||
text-overflow: unset !important;
|
||||
white-space: unset !important;
|
||||
}
|
||||
|
||||
.o_list_renderer .o_list_table tbody > tr > td:not(.o_list_record_selector):not(.o_handle_cell):not(.o_list_button):not(.o_list_record_remove) {
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
.o_status {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.czyg {
|
||||
font-size: 12px;
|
||||
margin-right: 10px;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.o_kanban_primary_left {
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
@@ -108,6 +108,7 @@ class CuttingToolModel(models.Model):
|
||||
tool_thickness = fields.Integer('厚度(mm)')
|
||||
tool_weight = fields.Float('重量(kg)')
|
||||
coating_material = fields.Char('涂层材质')
|
||||
|
||||
# 整体式刀具参数
|
||||
total_length = fields.Float('总长度(mm)')
|
||||
shank_length = fields.Float('柄部长度(mm)')
|
||||
|
||||
@@ -32,3 +32,4 @@ access_sf_sync_common,sf_sync_common,model_sf_sync_common,base.group_user,1,1,1,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -130,3 +130,35 @@ td.o_required_modifier {
|
||||
.o_list_renderer .o_list_table tbody > tr > td:not(.o_list_record_selector):not(.o_handle_cell):not(.o_list_button):not(.o_list_record_remove) {
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
.o_status {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.czyg {
|
||||
font-size: 12px;
|
||||
margin-right: 10px;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.o_kanban_primary_left {
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.diameter:before {
|
||||
content:"Ф";
|
||||
display:inline;
|
||||
}
|
||||
.diameter{
|
||||
display: flex !important;
|
||||
justify-content: flex-start !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
.o_address_format {
|
||||
display: flex !important;
|
||||
justify-content: flex-start !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
@@ -243,6 +243,7 @@
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<field name="blade_length"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
|
||||
<!--刀片-->
|
||||
<label for="tool_length" string="尺寸(mm)"
|
||||
attrs='{"invisible": [("cutting_tool_type","not in",("刀片","刀杆","刀盘"))]}'/>
|
||||
@@ -288,7 +289,7 @@
|
||||
<field name="blade_ids" widget="many2many_tags"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘'))]}"/>
|
||||
<field name="chuck_ids" widget="many2many_tags"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘','刀柄','整体式刀具'))]}"/>
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀杆','刀盘','刀柄'))]}"/>
|
||||
<field name="handle_ids" widget="many2many_tags"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('夹头'))]}"/>
|
||||
</group>
|
||||
@@ -306,7 +307,7 @@
|
||||
<field name="coating_material"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))]}"/>
|
||||
<field name="accuracy_level"
|
||||
attrs="{'invisible': [('cutting_tool_type', '=', '刀柄')]}"/>
|
||||
attrs="{'invisible': [('cutting_tool_type', 'in', ('刀柄'))]}"/>
|
||||
<field name="working_hardness"/>
|
||||
<field name="wrench"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('夹头','刀柄','刀杆','刀盘' ))]}"/>
|
||||
|
||||
@@ -1,47 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_product_template_only_form_inherit_sf">
|
||||
<field name="name">product.template.only.form.inherit.sf</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="barcode" position="replace">
|
||||
<field name='barcode' invisible="1"/>
|
||||
</field>
|
||||
<field name="default_code" position="replace">
|
||||
<field name='default_code' invisible="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_product_template_form_inherit_sf">
|
||||
<field name="name">product.template.form.inherit.sf</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="sale.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="list_price" position="before">
|
||||
<xpath expr="//label[@for='list_price']" position="before">
|
||||
<field name='categ_type' invisible="1"/>
|
||||
<field name="upload_model_file"
|
||||
widget="many2many_binary"
|
||||
attrs="{'invisible': ['|', ('categ_type', '!=', '成品'),('categ_type', '=', False)]}"/>
|
||||
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
||||
attrs="{'invisible': ['|','|', ('categ_type', '!=', '成品'),('categ_type', '=', False),('model_file', '=', False)]}"/>
|
||||
</xpath>
|
||||
<field name="categ_id" position="replace">
|
||||
<field name='categ_id' invisible="1"/>
|
||||
</field>
|
||||
<field name="product_tag_ids" position="after">
|
||||
<field name="default_code" attrs="{'invisible': [('product_variant_count', '>', 1)]}"/>
|
||||
<field name="barcode" attrs="{'invisible': [('product_variant_count', '>', 1)]}"/>
|
||||
</field>
|
||||
<field name="invoice_policy" position="after">
|
||||
<!-- <field name='categ_id'/>-->
|
||||
<field name='categ_id'/>
|
||||
<field name='cutting_tool_type' invisible="1"/>
|
||||
<field name="fixture_material_type" invisible="1"/>
|
||||
<field name="embryo_model_type_id" string="模型类型"
|
||||
attrs="{'invisible': ['|',('categ_type', '!=', '坯料'),('categ_type', '=', False)]}"/>
|
||||
<field name="materials_id" string="材料"
|
||||
<field name="materials_id" string="材料" placeholder="请选择"
|
||||
attrs="{'invisible': [('categ_type', 'not in', ['成品','坯料', '原材料'])]}"/>
|
||||
<field name="materials_type_id" string="型号"
|
||||
<field name="materials_type_id" string="型号" placeholder="请选择"
|
||||
domain="[('materials_id', '=', materials_id)]"
|
||||
attrs="{'invisible': [('categ_type', 'not in', ['成品','坯料', '原材料'])]}"/>
|
||||
<field name="server_product_process_parameters_id" string="表面工艺参数"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': ['|',('categ_type', '!=', '表面工艺'),('categ_type', '=', False)]}"/>
|
||||
<field name="cutting_tool_material_id" attrs="{'invisible': [('categ_type', '!=', '刀具')]}"/>
|
||||
<field name="cutting_tool_model_id"
|
||||
<field name="cutting_tool_material_id" attrs="{'invisible': [('categ_type', '!=', '刀具')]}"
|
||||
placeholder="请选择"/>
|
||||
<field name="cutting_tool_model_id" placeholder="请选择"
|
||||
context="{'default_cutting_tool_material_id': cutting_tool_material_id,'default_cutting_tool_type_id': cutting_tool_type_id}"
|
||||
attrs="{'invisible': [('categ_type', '!=', '刀具')]}"
|
||||
domain="[('cutting_tool_material_id','=',cutting_tool_material_id)]"/>
|
||||
<field name="fixture_material_id" attrs="{'invisible': [('categ_type', '!=', '夹具')]}"/>
|
||||
<field name="fixture_model_id" string="型号"
|
||||
<field name="fixture_material_id" attrs="{'invisible': [('categ_type', '!=', '夹具')]}"
|
||||
placeholder="请选择"/>
|
||||
<field name="fixture_model_id" string="型号" placeholder="请选择"
|
||||
context="{'default_fixture_material_id': fixture_material_id,'default_multi_mounting_type_id': fixture_multi_mounting_type_id}"
|
||||
attrs="{'invisible': [('categ_type', '!=', '夹具')]}"
|
||||
domain="[('fixture_material_id','=',fixture_material_id)]"/>
|
||||
</field>
|
||||
<!-- <field name="categ_id" position="replace">-->
|
||||
<!-- <field name='categ_id' invisible="1"/>-->
|
||||
<!-- </field>-->
|
||||
|
||||
<xpath expr="//label[@for='volume']" position="before">
|
||||
<label for="length" string="尺寸"
|
||||
attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>
|
||||
@@ -84,17 +105,46 @@
|
||||
<xpath expr="//page[last()-1]" position="after">
|
||||
<page string="刀具物料参数" attrs="{'invisible': [('categ_type', '!=', '刀具')]}">
|
||||
<group>
|
||||
<!--整体式刀具-->
|
||||
<group attrs="{'invisible': [('categ_type', '!=', '刀具')]}">
|
||||
<field name="brand_id" options="{'no_create': True}"/>
|
||||
<field name="materials_type_id" options="{'no_create': True}"/>
|
||||
<field name="cutting_tool_type_id" options="{'no_create': True}"/>
|
||||
<group attrs="{'invisible': [('categ_type', '!=', '刀具')]}" col="1">
|
||||
<field name="cutting_tool_type_id" options="{'no_create': True}" placeholder="请选择"/>
|
||||
<field name="brand_id" options="{'no_create': True}" placeholder="请选择"/>
|
||||
<field name="materials_type_id" options="{'no_create': True}"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'in', ('整体式刀具','夹头','刀柄'))]}"
|
||||
placeholder="请选择"/>
|
||||
<field name="cutting_tool_total_length"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀柄'))]}"/>
|
||||
<field name="cutting_tool_shank_length"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀柄','夹头'))]}"/>
|
||||
|
||||
<field name="cutting_tool_flange_length"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
|
||||
<field name="materials_type_id" options="{'no_create': True}" string="刀具材质"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"
|
||||
placeholder="请选择"/>
|
||||
<field name="tool_hardness" string="刀具硬度(hrc)"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<field name="materials_type_id" options="{'no_create': True}" string="夹头材质"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"
|
||||
placeholder="请选择"/>
|
||||
<field name="tool_hardness" string="夹头硬度(hrc)"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"/>
|
||||
<field name="materials_type_id" options="{'no_create': True}" string="刀柄材质"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"
|
||||
placeholder="请选择"/>
|
||||
<field name="tool_hardness" string="刀柄硬度(hrc)"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
|
||||
<field name="cutting_tool_blade_length"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<field name="cutting_tool_blade_diameter" string="刃部直径(mm)" class="diameter"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<field name="cutting_tool_blade_type"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<field name="cutting_tool_blade_helix_angle"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<field name="cutting_tool_blade_number" placeholder="请选择"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
|
||||
|
||||
<!--刀片-->
|
||||
<label for="tool_length" string="尺寸(mm)"
|
||||
attrs='{"invisible": [("cutting_tool_type","not in",("刀片","刀杆","刀盘"))]}'/>
|
||||
@@ -110,28 +160,159 @@
|
||||
<field name="tool_thickness" class="o_address_zip"
|
||||
options="{'format': false}"/>
|
||||
</div>
|
||||
<field name="cutting_tool_diameter"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片','刀杆','刀盘'))]}"/>
|
||||
<field name="cutting_tool_blade_diameter"
|
||||
<field name="cutting_tool_diameter" class="diameter"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片','刀杆','刀盘'))]}"/>
|
||||
<field name="cutting_tool_blade_diameter" class="diameter" string="刃径"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘'))]}"/>
|
||||
<field name="cutting_tool_blade_number"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片','刀杆','刀盘'))]}"/>
|
||||
<field name="cutting_tool_diameter_max"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_flange_length"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_flange_diameter"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片','刀杆','刀盘'))]}"/>
|
||||
<!--夹头-->
|
||||
<field name="cutting_tool_outer_diameter"
|
||||
|
||||
<field name="cutting_tool_clamping_way"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_clamping_length"
|
||||
attrs='{"invisible": [("cutting_tool_type","!=","夹头")]}'/>
|
||||
<field name="cutting_tool_inner_diameter"
|
||||
<field name="cutting_tool_clamping_tolerance"
|
||||
attrs='{"invisible": [("cutting_tool_type","!=","夹头")]}'/>
|
||||
<field name="tool_height" attrs='{"invisible": [("cutting_tool_type","!=","夹头")]}'/>
|
||||
<label for="cutting_tool_clamping_diameter_min" string="夹持直径"
|
||||
attrs='{"invisible": [("cutting_tool_type","not in",("夹头","刀柄"))]}'/>
|
||||
<div class="o_address_format"
|
||||
attrs='{"invisible": [("cutting_tool_type","not in",("夹头","刀柄"))]}'>
|
||||
<label for="cutting_tool_clamping_diameter_min" string="最小"/>
|
||||
<field name="cutting_tool_clamping_diameter_min" class="o_address_zip diameter"
|
||||
options="{'format': false}"
|
||||
attrs="{'required': [('cutting_tool_type','not in',('夹头','刀柄'))]}"/>
|
||||
<span>(mm)&nbsp;</span>
|
||||
<label for="cutting_tool_clamping_diameter_max" string="最大"/>
|
||||
<field name="cutting_tool_clamping_diameter_max" class="o_address_zip diameter"
|
||||
options="{'format': false}"
|
||||
attrs="{'required': [('cutting_tool_type','not in',('夹头','刀柄'))]}"/>
|
||||
<span>(mm)&nbsp;</span>
|
||||
</div>
|
||||
<field name="cutting_tool_head_diameter" class="diameter"
|
||||
attrs='{"invisible": [("cutting_tool_type","!=","夹头")]}'/>
|
||||
<field name="cutting_tool_outer_diameter" class="diameter"
|
||||
attrs='{"invisible": [("cutting_tool_type","!=","夹头")]}'/>
|
||||
<field name="cutting_tool_inner_diameter" class="diameter"
|
||||
attrs='{"invisible": [("cutting_tool_type","!=","夹头")]}'/>
|
||||
|
||||
<field name="cutting_tool_standard_speed"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_speed_max"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_change_time"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_cooling_type"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_dynamic_balance_class"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('categ_type', '!=', '刀具')]}">
|
||||
<!--整体式刀具-->
|
||||
<field name="cutting_tool_shank_length"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<field name="cutting_tool_shank_diameter" string="柄部直径(mm)" class="diameter"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<field name="cutting_tool_neck_length" string="颈部长度(mm)"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<field name="cutting_tool_neck_diameter" string="颈部直径(mm)" class="diameter"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<field name="cutting_tool_blade_tip_diameter" string="刀尖直径(mm)" class="diameter"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<field name="cutting_tool_blade_tip_taper" string="刀尖锥度(°)"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
|
||||
<label for="cutting_tool_run_out_accuracy_min" string="端跳精度"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}">
|
||||
<label for="cutting_tool_run_out_accuracy_min" string="最小"/>
|
||||
<field name="cutting_tool_run_out_accuracy_min" class="o_address_zip"
|
||||
options="{'format': false}"
|
||||
attrs="{'invisible': [('cutting_tool_type','!=','整体式刀具')]}"/>
|
||||
<span>(mm)&nbsp;</span>
|
||||
<label for="cutting_tool_run_out_accuracy_max" string="最大"/>
|
||||
<field name="cutting_tool_run_out_accuracy_max" class="o_address_zip"
|
||||
options="{'format': false}"
|
||||
attrs="{'invisible': [('cutting_tool_type','!=','整体式刀具')]}"/>
|
||||
<span>(mm)&nbsp;</span>
|
||||
</div>
|
||||
<field name="cutting_tool_coarse_medium_fine" string="粗/中/精" placeholder="请选择"
|
||||
attrs="{'required': [('cutting_tool_type','=','整体式刀具')],'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
|
||||
|
||||
<field name="tool_weight"
|
||||
attrs='{"invisible": [("cutting_tool_type","not in",("夹头","刀柄"))]}'/>
|
||||
<field name="cutting_tool_clamping_diameter"
|
||||
<field name="cutting_tool_taper"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('夹头','刀柄'))]}"/>
|
||||
|
||||
<label for="cutting_tool_detection_accuracy_min" string="检测精度"
|
||||
attrs='{"invisible": [("cutting_tool_type","not in",("刀柄"))]}'/>
|
||||
<div class="o_address_format"
|
||||
attrs='{"invisible": [("cutting_tool_type","not in",("刀柄"))]}'>
|
||||
<label for="cutting_tool_detection_accuracy_min" string="最小"/>
|
||||
<field name="cutting_tool_detection_accuracy_min" class="o_address_zip"
|
||||
options="{'format': false}"
|
||||
attrs="{'required': [('cutting_tool_type','=','刀柄')]}"/>
|
||||
<span>(mm)&nbsp;</span>
|
||||
<label for="cutting_tool_detection_accuracy_max" string="最大"/>
|
||||
<field name="cutting_tool_detection_accuracy_max" class="o_address_zip"
|
||||
options="{'format': false}"
|
||||
attrs="{'required': [('cutting_tool_type','=','刀柄')]}"/>
|
||||
<span>(mm)&nbsp;</span>
|
||||
</div>
|
||||
<field name="cutting_tool_body_accuracy"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_jump_accuracy"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_front_angle"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/>
|
||||
<field name="cutting_tool_top_angle"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/>
|
||||
<field name="cutting_tool_rear_angle"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/>
|
||||
<field name="cutting_tool_main_included_angle"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/>
|
||||
<field name="coating_material"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片','刀柄'))]}"/>
|
||||
<field name="cutting_tool_accuracy_level"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'in', ('刀柄', '整体式刀具','夹头'))]}"/>
|
||||
<field name="cutting_tool_working_hardness"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'in', ('整体式刀具','夹头','刀柄'))]}"/>
|
||||
|
||||
<!-- <field name="tool_height" attrs='{"invisible": [("cutting_tool_type","!=","夹头")]}'/>-->
|
||||
|
||||
|
||||
<field name="cutting_tool_is_rough_finish"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_is_finish"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_is_drill_hole"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_is_high_speed_cutting"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_is_safety_lock" string="有无安全锁"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
|
||||
|
||||
<field name="cutting_tool_jump_accuracy" string="跳动精度(mm)"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"/>
|
||||
<field name="coating_material"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"/>
|
||||
<field name="cutting_tool_er_size_model"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"/>
|
||||
<field name="cutting_tool_handle_ids" widget="many2many_tags"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"/>
|
||||
<field name="cooling_suit_type_ids"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}"/>
|
||||
|
||||
<field name="cutting_tool_wrench"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘' ))]}"/>
|
||||
<!-- <field name="cutting_tool_screw"-->
|
||||
<!-- attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀柄'))]}"/>-->
|
||||
<field name="cutting_tool_nut"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/>
|
||||
|
||||
<field name="cutting_tool_cutter_bar_ids" widget="many2many_tags"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/>
|
||||
@@ -141,37 +322,79 @@
|
||||
<field name="cutting_tool_blade_ids" widget="many2many_tags"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘'))]}"/>
|
||||
|
||||
<field name="cutting_tool_chuck_ids" widget="many2many_tags"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘','刀柄','整体式刀具'))]}"/>
|
||||
<field name="cutting_tool_handle_ids" widget="many2many_tags"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('夹头'))]}"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('categ_type', '!=', '刀具')]}">
|
||||
<field name="cutting_tool_jump_accuracy"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘','刀柄'))]}"/>
|
||||
<field name="apply_lock_nut_model"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_front_angle"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))]}"/>
|
||||
<field name="cutting_tool_top_angle"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))]}"/>
|
||||
<field name="cutting_tool_rear_angle"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))]}"/>
|
||||
<field name="cutting_tool_main_included_angle"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))]}"/>
|
||||
<field name="coating_material"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))]}"/>
|
||||
<field name="cutting_tool_accuracy_level"
|
||||
attrs="{'invisible': [('cutting_tool_type', '=', '刀柄')]}"/>
|
||||
<field name="cutting_tool_working_hardness"/>
|
||||
<field name="cutting_tool_wrench"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('夹头','刀柄','刀杆','刀盘' ))]}"/>
|
||||
<field name="cutting_tool_screw"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('夹头','刀柄'))]}"/>
|
||||
<field name="cutting_tool_nut"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))]}"/>
|
||||
<field name="apply_lock_wrench_model"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
|
||||
|
||||
</group>
|
||||
</group>
|
||||
<group col="1" attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}">
|
||||
<group string="适合加工方式">
|
||||
<field name="suitable_machining_method_ids" string="" widget="many2many_checkboxes"/>
|
||||
</group>
|
||||
<group>
|
||||
<group string="刀尖特征">
|
||||
<field name="blade_tip_characteristics_ids" string=""
|
||||
widget="many2many_checkboxes"/>
|
||||
</group>
|
||||
<group string="柄部类型">
|
||||
<field name="handle_type_ids" string="" widget="many2many_checkboxes"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group string="走刀方向">
|
||||
<field name="cutting_direction_ids" string="" widget="many2many_checkboxes"/>
|
||||
</group>
|
||||
<group string="适合冷却液">
|
||||
<field name="suitable_coolant_ids" string="" widget="many2many_checkboxes"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="切削速度Vc">
|
||||
<field name="cutting_speed_ids" string="" widget="one2many">
|
||||
<tree editable="bottom">
|
||||
<!-- <field name="order"/>-->
|
||||
<field name="execution_standard_id"/>
|
||||
<field name="material_code"/>
|
||||
<field name="material_name"/>
|
||||
<field name="material_grade"/>
|
||||
<field name="tensile_strength"/>
|
||||
<field name="hardness"/>
|
||||
<field name="cutting_speed_n1"/>
|
||||
<field name="cutting_speed_n2"/>
|
||||
<field name="cutting_speed_n3"/>
|
||||
<field name="cutting_speed_n4"/>
|
||||
<field name="cutting_speed_n5"/>
|
||||
<field name="rough_machining"/>
|
||||
<field name="precision_machining"/>
|
||||
<field name="application"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="每齿走刀量fz">
|
||||
<field name="feed_per_tooth_ids" string="" widget="one2many">
|
||||
<tree editable="bottom">
|
||||
<field name="cutting_speed"
|
||||
attrs="{'readonly': [('materials_type_id','!=',False)]}"/>
|
||||
<field name="machining_method" placeholder="请选择"
|
||||
attrs="{'readonly': [('cutting_speed','!=',False)]}"/>
|
||||
<field name="materials_type_id" placeholder="请选择"
|
||||
attrs="{'readonly': [('cutting_speed','!=',False)]}"/>
|
||||
<field name="blade_diameter"/>
|
||||
<field name="feed_per_tooth"/>
|
||||
<field name="unit"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
</group>
|
||||
</page>
|
||||
<page string="夹具物料参数" attrs="{'invisible': [('categ_type', '!=', '夹具')]}">
|
||||
<group attrs='{"invisible": [("fixture_material_type","not in",("气动夹具","转接板(锁板)夹具","磁吸夹具","虎钳夹具","零点卡盘"))]}'>
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
<field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//header" position="inside">
|
||||
<button string="程序下载" name="cnc_file_download" type="object" class="oe_highlight"/>
|
||||
<button string="程序下载" name="cnc_file_download" type="object" class="oe_highlight" attrs='{"invisible": ["|",
|
||||
("user_permissions","=",False),("routing_type","!=","CNC加工")]}'/>
|
||||
</xpath>
|
||||
<xpath expr="//page//field[@name='cnc_ids']" position="before">
|
||||
<group>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
'views/mrp_workcenter_views.xml',
|
||||
'views/mrp_workorder_view.xml',
|
||||
'views/production_line_view.xml',
|
||||
'views/tool_other_features_view.xml',
|
||||
# 'views/tray_view.xml',
|
||||
'views/model_type_view.xml',
|
||||
# 'views/kanban_change.xml'
|
||||
|
||||
@@ -9,6 +9,7 @@ from . import mrp_routing_workcenter
|
||||
from . import stock
|
||||
from . import res_user
|
||||
from . import production_line_base
|
||||
from . import tool_other_features
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -339,7 +339,7 @@ class MrpProduction(models.Model):
|
||||
current_sequence += 1
|
||||
if work.name == '获取CNC加工程序':
|
||||
work.button_start()
|
||||
#work.fetchCNC()
|
||||
# work.fetchCNC()
|
||||
|
||||
# 创建工单并进行排序
|
||||
def _create_workorder(self):
|
||||
|
||||
@@ -25,7 +25,6 @@ class ResProductMo(models.Model):
|
||||
# if record:
|
||||
# record.categ_type = record.categ_id.type
|
||||
|
||||
|
||||
categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True)
|
||||
|
||||
model_name = fields.Char('模型名称')
|
||||
@@ -63,26 +62,132 @@ class ResProductMo(models.Model):
|
||||
|
||||
cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', string='型号',
|
||||
)
|
||||
cutting_tool_type_id = fields.Many2one('sf.cutting.tool.type', string='刀具类型',
|
||||
cutting_tool_type_id = fields.Many2one('sf.cutting.tool.type', string='类型',
|
||||
domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]")
|
||||
|
||||
brand_id = fields.Many2one('sf.machine.brand', '品牌')
|
||||
tool_length = fields.Integer('长度(mm)')
|
||||
tool_width = fields.Integer('宽度(mm)')
|
||||
tool_height = fields.Integer('高度(mm)')
|
||||
tool_length = fields.Float('长度(mm)')
|
||||
tool_width = fields.Float('宽度(mm)')
|
||||
tool_height = fields.Float('高度(mm)')
|
||||
tool_thickness = fields.Integer('厚度(mm)')
|
||||
tool_weight = fields.Float('重量(kg)')
|
||||
tool_hardness = fields.Integer('硬度(hrc)')
|
||||
|
||||
coating_material = fields.Char('涂层材质')
|
||||
# 整体式刀具参数
|
||||
cutting_tool_total_length = fields.Float('总长度(mm)')
|
||||
cutting_tool_shank_length = fields.Float('柄部长度(mm)')
|
||||
cutting_tool_blade_length = fields.Float('刃部长度(mm)')
|
||||
# 整体式刀具特有字段
|
||||
cutting_tool_total_length = fields.Float('总长度(mm)', digits=(6, 1))
|
||||
cutting_tool_shank_length = fields.Float('柄部长度(mm)', digits=(6, 1))
|
||||
cutting_tool_blade_length = fields.Float('刃部长度(mm)', digits=(6, 1))
|
||||
cutting_tool_blade_number = fields.Selection(
|
||||
[('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8')], '刃数(个)')
|
||||
# 整体式刀具新增字段
|
||||
cutting_tool_neck_length = fields.Float('颈部长度(mm)', digits=(6, 1))
|
||||
cutting_tool_neck_diameter = fields.Float('颈部直径(mm)', digits=(6, 1))
|
||||
cutting_tool_shank_diameter = fields.Float('柄部直径(mm)', digits=(6, 1))
|
||||
cutting_tool_blade_tip_diameter = fields.Float('刀尖直径(mm)', digits=(6, 1))
|
||||
cutting_tool_blade_tip_taper = fields.Integer('刀尖锥度(°)')
|
||||
cutting_tool_blade_helix_angle = fields.Integer('刃部螺旋角(°)')
|
||||
cutting_tool_blade_type = fields.Char('刃部类型')
|
||||
cutting_tool_coarse_medium_fine = fields.Selection([('粗', '粗'), ('中', '中'), ('精', '精')], '粗/中/精')
|
||||
cutting_tool_run_out_accuracy_max = fields.Float('端跳精度max', digits=(6, 1))
|
||||
cutting_tool_run_out_accuracy_min = fields.Float('端跳精度min', digits=(6, 1))
|
||||
suitable_machining_method_ids = fields.Many2many('sf.suitable.machining.method',
|
||||
'rel_suitable_machining_method_product_template', '适合加工方式')
|
||||
blade_tip_characteristics_ids = fields.Many2many('sf.blade.tip.characteristics',
|
||||
'rel_blade_tip_characteristics_product_template', '刀尖特征')
|
||||
handle_type_ids = fields.Many2many('sf.handle.type', 'rel_handle_type_product_template', '柄部类型')
|
||||
cutting_direction_ids = fields.Many2many('sf.cutting.direction', 'rel_cutting_direction_product_template',
|
||||
'走刀方向')
|
||||
suitable_coolant_ids = fields.Many2many('sf.suitable.coolant', 'rel_suitable_coolant_product_template',
|
||||
'适合冷却液')
|
||||
|
||||
# @api.constrains('suitable_machining_method_ids')
|
||||
# def _check_suitable_machining_method_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("适合加工方式不能为空!")
|
||||
#
|
||||
# @api.constrains('blade_tip_characteristics_ids')
|
||||
# def _check_blade_tip_characteristics_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.blade_tip_characteristics_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刀尖特征不能为空!")
|
||||
# if len(record.blade_tip_characteristics_ids) > 1 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刀尖特征只能单选!")
|
||||
#
|
||||
# @api.constrains('handle_type_ids')
|
||||
# def _check_handle_type_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.handle_type_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部类型不能为空!")
|
||||
# if len(record.handle_type_ids) > 1 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部类型只能单选!")
|
||||
#
|
||||
# @api.constrains('cutting_direction_ids')
|
||||
# def _check_cutting_direction_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.cutting_direction_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("走刀方向不能为空!")
|
||||
#
|
||||
# @api.constrains('suitable_coolant_ids')
|
||||
# def _check_suitable_coolant_ids(self):
|
||||
# for record in self:
|
||||
# if not record.suitable_coolant_ids and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("适合冷却液不能为空!")
|
||||
#
|
||||
# @api.constrains('cutting_tool_total_length')
|
||||
# def _check_cutting_tool_total_length(self):
|
||||
# if self.cutting_tool_total_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("总长度不能为0")
|
||||
#
|
||||
# @api.constrains('cutting_tool_shank_length')
|
||||
# def _check_cutting_tool_shank_length(self):
|
||||
# if self.cutting_tool_shank_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部长度不能为0")
|
||||
#
|
||||
# @api.constrains('cutting_tool_blade_length')
|
||||
# def _check_cutting_tool_blade_length(self):
|
||||
# if self.cutting_tool_blade_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刃部长度不能为0")
|
||||
#
|
||||
# @api.constrains('cutting_tool_blade_number')
|
||||
# def _check_cutting_tool_blade_number(self):
|
||||
# if self.cutting_tool_blade_number <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刃数不能为0")
|
||||
#
|
||||
# @api.constrains('integral_shank_diameter')
|
||||
# def _check_integral_shank_diameter(self):
|
||||
# if self.integral_shank_diameter <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部直径不能为0")
|
||||
#
|
||||
# @api.constrains('integral_blade_diameter')
|
||||
# def _check_integral_blade_diameter(self):
|
||||
# if self.integral_blade_diameter <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刃部直径不能为0")
|
||||
#
|
||||
# @api.constrains('integral_run_out_accuracy_min')
|
||||
# def _check_integral_blade_diameter(self):
|
||||
# if self.integral_run_out_accuracy_min <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("端跳精度最小(min)不能为0")
|
||||
|
||||
cutting_speed_ids = fields.One2many('sf.cutting.speed', 'product_template_id', string='切削速度Vc')
|
||||
feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'product_template_id', string='每齿走刀量fz')
|
||||
|
||||
# @api.constrains('suitable_machining_method_ids')
|
||||
# def _check_suitable_machining_method_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("适合加工方式不能为空!")
|
||||
|
||||
# @api.constrains('integral_run_out_accuracy_max')
|
||||
# def _check_integral_run_out_accuracy_max(self):
|
||||
# if self.integral_run_out_accuracy_max <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("端跳精度最大(max)不能为0")
|
||||
|
||||
cutting_tool_diameter = fields.Float('直径(mm)')
|
||||
cutting_tool_blade_number = fields.Integer('刃数')
|
||||
cutting_tool_front_angle = fields.Float('前角(°)')
|
||||
cutting_tool_rear_angle = fields.Float('后角(°)')
|
||||
cutting_tool_main_included_angle = fields.Float('主偏角(°)')
|
||||
cutting_tool_front_angle = fields.Integer('前角(°)')
|
||||
cutting_tool_rear_angle = fields.Integer('后角(°)')
|
||||
cutting_tool_main_included_angle = fields.Integer('主偏角(°)')
|
||||
# cutting_tool_material_model_id = fields.Many2one('sf.materials.model', '材料型号')
|
||||
cutting_tool_nut = fields.Float('配对螺母(mm)')
|
||||
# 适用夹头型号可以多选
|
||||
@@ -94,8 +199,8 @@ class ResProductMo(models.Model):
|
||||
domain="[('cutting_tool_type', '=', '夹头')]",
|
||||
string='适用夹头型号')
|
||||
# 刀片参数
|
||||
cutting_tool_top_angle = fields.Float('顶角(°)')
|
||||
cutting_tool_jump_accuracy = fields.Float('径跳精度(um)')
|
||||
cutting_tool_top_angle = fields.Integer('顶角(°)')
|
||||
cutting_tool_jump_accuracy = fields.Float('径跳精度(mm)')
|
||||
cutting_tool_working_hardness = fields.Char('加工硬度(hrc)')
|
||||
cutting_tool_cutter_bar_ids = fields.Many2many(
|
||||
'sf.cutting.tool.model',
|
||||
@@ -114,7 +219,7 @@ class ResProductMo(models.Model):
|
||||
string='适用刀盘型号' # 使用空列表作为默认值
|
||||
)
|
||||
# 刀杆/参数
|
||||
cutting_tool_blade_diameter = fields.Float('刃径(mm)')
|
||||
cutting_tool_blade_diameter = fields.Float('刃径/刃部直径(mm)')
|
||||
cutting_tool_blade_ids = fields.Many2many(
|
||||
'sf.cutting.tool.model',
|
||||
relation='product_cutting_tool_model_pad_blade_rel',
|
||||
@@ -124,16 +229,41 @@ class ResProductMo(models.Model):
|
||||
string='适用刀片型号' # 使用空列表作为默认值
|
||||
)
|
||||
cutting_tool_wrench = fields.Float('配对扳手(mm)')
|
||||
cutting_tool_screw = fields.Float('配备螺丝(mm)')
|
||||
# cutting_tool_screw = fields.Float('配备螺丝(mm)')
|
||||
cutting_tool_accuracy_level = fields.Char('精度等级')
|
||||
# 刀柄参数
|
||||
cutting_tool_head_diameter = fields.Float('头部直径')
|
||||
cutting_tool_diameter_max = fields.Float('最大直径(mm)')
|
||||
cutting_tool_clamping_diameter = fields.Float('夹持直径(mm)')
|
||||
cutting_tool_flange_length = fields.Float('法兰柄长度(mm)')
|
||||
cutting_tool_clamping_length = fields.Float('夹持长度(mm)')
|
||||
cutting_tool_clamping_tolerance = fields.Float('夹持公差(mm)')
|
||||
cutting_tool_clamping_diameter_max = fields.Float('最大夹持直径')
|
||||
cutting_tool_clamping_diameter_min = fields.Float('最小夹持直径')
|
||||
cutting_tool_flange_length = fields.Float('法兰柄长(mm)')
|
||||
cutting_tool_flange_diameter = fields.Float('法兰直径(mm)')
|
||||
cutting_tool_is_rough_finish = fields.Boolean('可粗加工', default=False)
|
||||
cutting_tool_is_finish = fields.Boolean('可精加工', default=False)
|
||||
cutting_tool_is_drill_hole = fields.Boolean('可钻孔', default=False)
|
||||
cutting_tool_is_safety_lock = fields.Boolean('安全锁', default=False)
|
||||
cutting_tool_is_high_speed_cutting = fields.Boolean('可高速切削', default=False)
|
||||
cutting_tool_dynamic_balance_class = fields.Char('动平衡等级')
|
||||
cutting_tool_change_time = fields.Integer('换刀时间(s)')
|
||||
cutting_tool_clamping_way = fields.Char('夹持方式')
|
||||
cutting_tool_standard_speed = fields.Integer('标准转速(n/min)')
|
||||
cutting_tool_speed_max = fields.Integer('最大转速(n/min)')
|
||||
cutting_tool_cooling_type = fields.Char('冷却类型')
|
||||
cutting_tool_body_accuracy = fields.Float('本体精度(mm)')
|
||||
apply_lock_nut_model = fields.Char('适用锁紧螺母型号')
|
||||
apply_lock_wrench_model = fields.Char('适用锁紧扳手型号')
|
||||
cutting_tool_detection_accuracy_max = fields.Float('最大检测精度(mm)')
|
||||
cutting_tool_detection_accuracy_min = fields.Float('最小检测精度(mm)')
|
||||
# 夹头参数
|
||||
cutting_tool_taper = fields.Integer('锥度(°)')
|
||||
cutting_tool_outer_diameter = fields.Float('外径(mm)')
|
||||
cutting_tool_inner_diameter = fields.Float('内径(mm)')
|
||||
cooling_suit_type_ids = fields.Char('适用冷却套型号')
|
||||
# cooling_suit_type_ids = fields.Many2many('冷却类型')
|
||||
cutting_tool_er_size_model = fields.Char('ER尺寸型号')
|
||||
cutting_tool_handle_ids = fields.Many2many(
|
||||
'sf.cutting.tool.model',
|
||||
relation='product_cutting_tool_model_chuck_handle_rel',
|
||||
@@ -312,84 +442,119 @@ class ResProductMo(models.Model):
|
||||
item.fixture_apply_machine_tool_type_ids = 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):
|
||||
for item in self:
|
||||
if self.cutting_tool_type is not False:
|
||||
item.brand_id = item.cutting_tool_model_id.brand_id.id
|
||||
item.cutting_tool_type_id = item.cutting_tool_model_id.cutting_tool_type_id.id
|
||||
item.tool_length = item.cutting_tool_model_id.tool_length
|
||||
item.tool_width = item.cutting_tool_model_id.tool_width
|
||||
item.tool_height = item.cutting_tool_model_id.tool_height
|
||||
item.tool_thickness = item.cutting_tool_model_id.tool_thickness
|
||||
item.tool_weight = item.cutting_tool_model_id.tool_weight
|
||||
item.coating_material = item.cutting_tool_model_id.coating_material
|
||||
item.cutting_tool_total_length = item.cutting_tool_model_id.total_length
|
||||
item.cutting_tool_shank_length = item.cutting_tool_model_id.shank_length
|
||||
item.cutting_tool_blade_length = item.cutting_tool_model_id.blade_length
|
||||
item.cutting_tool_diameter = item.cutting_tool_model_id.diameter
|
||||
item.cutting_tool_blade_number = item.cutting_tool_model_id.blade_number
|
||||
item.cutting_tool_front_angle = item.cutting_tool_model_id.front_angle
|
||||
item.cutting_tool_rear_angle = item.cutting_tool_model_id.rear_angle
|
||||
item.cutting_tool_main_included_angle = item.cutting_tool_model_id.main_included_angle
|
||||
item.materials_type_id = item.cutting_tool_model_id.material_model_id.id
|
||||
item.cutting_tool_nut = item.cutting_tool_model_id.nut
|
||||
item.cutting_tool_top_angle = item.cutting_tool_model_id.top_angle
|
||||
item.cutting_tool_jump_accuracy = item.cutting_tool_model_id.jump_accuracy
|
||||
item.cutting_tool_working_hardness = item.cutting_tool_model_id.working_hardness
|
||||
item.cutting_tool_blade_diameter = item.cutting_tool_model_id.blade_diameter
|
||||
item.cutting_tool_wrench = item.cutting_tool_model_id.wrench
|
||||
item.cutting_tool_screw = item.cutting_tool_model_id.screw
|
||||
item.cutting_tool_accuracy_level = item.cutting_tool_model_id.accuracy_level
|
||||
item.cutting_tool_diameter_max = item.cutting_tool_model_id.diameter_max
|
||||
item.cutting_tool_clamping_diameter = item.cutting_tool_model_id.clamping_diameter
|
||||
item.cutting_tool_flange_length = item.cutting_tool_model_id.flange_length
|
||||
item.cutting_tool_flange_diameter = item.cutting_tool_model_id.flange_diameter
|
||||
item.cutting_tool_outer_diameter = item.cutting_tool_model_id.outer_diameter
|
||||
item.cutting_tool_inner_diameter = item.cutting_tool_model_id.inner_diameter
|
||||
item.cutting_tool_chuck_ids = self._get_ids(item.cutting_tool_model_id.chuck_ids)
|
||||
item.cutting_tool_cutter_bar_ids = self._get_ids(item.cutting_tool_model_id.cutter_bar_ids)
|
||||
item.cutting_tool_cutter_pad_ids = self._get_ids(item.cutting_tool_model_id.cutter_pad_ids)
|
||||
item.cutting_tool_blade_ids = self._get_ids(item.cutting_tool_model_id.blade_ids)
|
||||
item.cutting_tool_handle_ids = self._get_ids(item.cutting_tool_model_id.handle_ids)
|
||||
else:
|
||||
item.brand_id = False
|
||||
item.cutting_tool_type_id = False
|
||||
item.brand_id = False
|
||||
item.tool_length = False
|
||||
item.tool_width = False
|
||||
item.tool_height = False
|
||||
item.tool_thickness = False
|
||||
item.tool_weight = False
|
||||
item.coating_material = False
|
||||
item.cutting_tool_total_length = False
|
||||
item.cutting_tool_shank_length = False
|
||||
item.cutting_tool_blade_length = False
|
||||
item.cutting_tool_diameter = False
|
||||
item.cutting_tool_blade_number = False
|
||||
item.cutting_tool_front_angle = False
|
||||
item.cutting_tool_rear_angle = False
|
||||
item.cutting_tool_main_included_angle = False
|
||||
item.materials_type_id = False
|
||||
item.cutting_tool_nut = False
|
||||
item.cutting_tool_top_angle = False
|
||||
item.cutting_tool_jump_accuracy = False
|
||||
item.cutting_tool_working_hardness = False
|
||||
item.cutting_tool_blade_diameter = False
|
||||
item.cutting_tool_wrench = False
|
||||
item.cutting_tool_screw = False
|
||||
item.cutting_tool_accuracy_level = False
|
||||
item.cutting_tool_diameter_max = False
|
||||
item.cutting_tool_clamping_diameter = False
|
||||
item.cutting_tool_flange_length = False
|
||||
item.cutting_tool_flange_diameter = False
|
||||
item.cutting_tool_outer_diameter = False
|
||||
item.cutting_tool_inner_diameter = False
|
||||
item.cutting_tool_chuck_ids = False
|
||||
item.cutting_tool_cutter_bar_ids = False
|
||||
item.cutting_tool_cutter_pad_ids = False
|
||||
item.cutting_tool_blade_ids = False
|
||||
item.cutting_tool_handle_ids = False
|
||||
# @api.onchange('cutting_tool_model_id')
|
||||
# def _onchange_cutting_tool_model_id(self):
|
||||
# for item in self:
|
||||
# if self.cutting_tool_type is not False:
|
||||
# item.brand_id = item.cutting_tool_model_id.brand_id.id
|
||||
# item.cutting_tool_type_id = item.cutting_tool_model_id.cutting_tool_type_id.id
|
||||
# item.tool_length = item.cutting_tool_model_id.tool_length
|
||||
# item.tool_width = item.cutting_tool_model_id.tool_width
|
||||
# item.tool_height = item.cutting_tool_model_id.tool_height
|
||||
# item.tool_thickness = item.cutting_tool_model_id.tool_thickness
|
||||
# item.tool_weight = item.cutting_tool_model_id.tool_weight
|
||||
# item.coating_material = item.cutting_tool_model_id.coating_material
|
||||
# item.cutting_tool_total_length = item.cutting_tool_model_id.total_length
|
||||
# item.cutting_tool_shank_length = item.cutting_tool_model_id.shank_length
|
||||
# item.cutting_tool_neck_length = item.cutting_tool_model_id.cutting_tool_neck_length
|
||||
# item.cutting_tool_shank_diameter = item.cutting_tool_model_id.cutting_tool_shank_diameter
|
||||
# item.cutting_tool_blade_diameter = item.cutting_tool_model_id.cutting_tool_blade_diameter
|
||||
# item.cutting_tool_neck_diameter = item.cutting_tool_model_id.cutting_tool_neck_diameter
|
||||
# item.cutting_tool_blade_tip_diameter = item.cutting_tool_model_id.cutting_tool_blade_tip_diameter
|
||||
# item.cutting_tool_blade_tip_taper = item.cutting_tool_model_id.cutting_tool_blade_tip_taper
|
||||
# item.cutting_tool_blade_helix_angle = item.cutting_tool_model_id.cutting_tool_blade_helix_angle
|
||||
# item.cutting_tool_blade_type = item.cutting_tool_model_id.cutting_tool_blade_type
|
||||
# item.cutting_tool_coarse_medium_fine = item.cutting_tool_model_id.cutting_tool_coarse_medium_fine
|
||||
# item.tool_hardness = item.cutting_tool_model_id.tool_hardness
|
||||
# item.cutting_tool_run_out_accuracy_max = item.cutting_tool_model_id.cutting_tool_run_out_accuracy_max
|
||||
# item.cutting_tool_run_out_accuracy_min = item.cutting_tool_model_id.cutting_tool_run_out_accuracy_min
|
||||
# item.suitable_machining_method_ids = self._get_ids(
|
||||
# item.cutting_tool_model_id.suitable_machining_method_ids)
|
||||
# item.blade_tip_characteristics_ids = self._get_ids(
|
||||
# item.cutting_tool_model_id.blade_tip_characteristics_ids)
|
||||
# item.handle_type_ids = self._get_ids(item.cutting_tool_model_id.handle_type_ids)
|
||||
# item.cutting_direction_ids = self._get_ids(item.cutting_tool_model_id.cutting_direction_ids)
|
||||
# item.suitable_coolant_ids = self._get_ids(item.cutting_tool_model_id.suitable_coolant_ids)
|
||||
# item.cutting_tool_diameter = item.cutting_tool_model_id.diameter
|
||||
# item.cutting_tool_blade_number = item.cutting_tool_model_id.blade_number
|
||||
# item.cutting_tool_front_angle = item.cutting_tool_model_id.front_angle
|
||||
# item.cutting_tool_rear_angle = item.cutting_tool_model_id.rear_angle
|
||||
# item.cutting_tool_main_included_angle = item.cutting_tool_model_id.main_included_angle
|
||||
# item.materials_type_id = item.cutting_tool_model_id.material_model_id.id
|
||||
# item.cutting_tool_nut = item.cutting_tool_model_id.nut
|
||||
# item.cutting_tool_top_angle = item.cutting_tool_model_id.top_angle
|
||||
# item.cutting_tool_jump_accuracy = item.cutting_tool_model_id.jump_accuracy
|
||||
# item.cutting_tool_working_hardness = item.cutting_tool_model_id.working_hardness
|
||||
# item.cutting_tool_blade_diameter = item.cutting_tool_model_id.blade_diameter
|
||||
# item.cutting_tool_wrench = item.cutting_tool_model_id.wrench
|
||||
# # item.cutting_tool_screw = item.cutting_tool_model_id.screw
|
||||
# item.cutting_tool_accuracy_level = item.cutting_tool_model_id.accuracy_level
|
||||
# item.cutting_tool_diameter_max = item.cutting_tool_model_id.diameter_max
|
||||
# item.cutting_tool_clamping_diameter = item.cutting_tool_model_id.clamping_diameter
|
||||
# item.cutting_tool_flange_length = item.cutting_tool_model_id.flange_length
|
||||
# item.cutting_tool_flange_diameter = item.cutting_tool_model_id.flange_diameter
|
||||
# item.cutting_tool_outer_diameter = item.cutting_tool_model_id.outer_diameter
|
||||
# item.cutting_tool_inner_diameter = item.cutting_tool_model_id.inner_diameter
|
||||
# item.cutting_tool_chuck_ids = self._get_ids(item.cutting_tool_model_id.chuck_ids)
|
||||
# item.cutting_tool_cutter_bar_ids = self._get_ids(item.cutting_tool_model_id.cutter_bar_ids)
|
||||
# item.cutting_tool_cutter_pad_ids = self._get_ids(item.cutting_tool_model_id.cutter_pad_ids)
|
||||
# item.cutting_tool_blade_ids = self._get_ids(item.cutting_tool_model_id.blade_ids)
|
||||
# item.cutting_tool_handle_ids = self._get_ids(item.cutting_tool_model_id.handle_ids)
|
||||
# else:
|
||||
# item.brand_id = False
|
||||
# item.cutting_tool_type_id = False
|
||||
# item.brand_id = False
|
||||
# item.tool_length = False
|
||||
# item.tool_width = False
|
||||
# item.tool_height = False
|
||||
# item.tool_thickness = False
|
||||
# item.tool_weight = False
|
||||
# item.coating_material = False
|
||||
# item.cutting_tool_total_length = False
|
||||
# item.cutting_tool_shank_length = False
|
||||
# item.cutting_tool_blade_length = False
|
||||
# item.cutting_tool_neck_length = False
|
||||
# item.cutting_tool_shank_diameter = False
|
||||
# item.cutting_tool_blade_diameter = False
|
||||
# item.cutting_tool_neck_diameter = False
|
||||
# item.cutting_tool_blade_tip_diameter = False
|
||||
# item.cutting_tool_blade_tip_taper = False
|
||||
# item.cutting_tool_blade_helix_angle = False
|
||||
# item.cutting_tool_blade_type = False
|
||||
# item.cutting_tool_coarse_medium_fine = False
|
||||
# item.tool_hardness = False
|
||||
# item.cutting_tool_run_out_accuracy_max = False
|
||||
# item.cutting_tool_run_out_accuracy_min = False
|
||||
# item.suitable_machining_method_ids = False
|
||||
# item.blade_tip_characteristics_ids = False
|
||||
# item.handle_type_ids = False
|
||||
# item.cutting_direction_ids = False
|
||||
# item.suitable_coolant_ids = False
|
||||
# item.cutting_tool_diameter = False
|
||||
# item.cutting_tool_blade_number = False
|
||||
# item.cutting_tool_front_angle = False
|
||||
# item.cutting_tool_rear_angle = False
|
||||
# item.cutting_tool_main_included_angle = False
|
||||
# item.materials_type_id = False
|
||||
# item.cutting_tool_nut = False
|
||||
# item.cutting_tool_top_angle = False
|
||||
# item.cutting_tool_jump_accuracy = False
|
||||
# item.cutting_tool_working_hardness = False
|
||||
# item.cutting_tool_blade_diameter = False
|
||||
# item.cutting_tool_wrench = False
|
||||
# # item.cutting_tool_screw = False
|
||||
# item.cutting_tool_accuracy_level = False
|
||||
# item.cutting_tool_diameter_max = False
|
||||
# item.cutting_tool_clamping_diameter = False
|
||||
# item.cutting_tool_flange_length = False
|
||||
# item.cutting_tool_flange_diameter = False
|
||||
# item.cutting_tool_outer_diameter = False
|
||||
# item.cutting_tool_inner_diameter = False
|
||||
# item.cutting_tool_chuck_ids = False
|
||||
# item.cutting_tool_cutter_bar_ids = False
|
||||
# item.cutting_tool_cutter_pad_ids = False
|
||||
# item.cutting_tool_blade_ids = False
|
||||
# item.cutting_tool_handle_ids = False
|
||||
|
||||
def _get_volume_uom_id_from_ir_config_parameter(self):
|
||||
product_length_in_feet_param = self.env['ir.config_parameter'].sudo().get_param('product.volume_in_cubic_feet')
|
||||
@@ -597,8 +762,7 @@ class ResMrpBomMo(models.Model):
|
||||
}
|
||||
return self.env['mrp.bom.line'].create(vals)
|
||||
|
||||
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品后再次进行创建bom
|
||||
|
||||
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品后再次进行创建bom
|
||||
def bom_create(self, product, bom_type, product_type):
|
||||
bom_id = self.env['mrp.bom'].create({
|
||||
'product_tmpl_id': product.product_tmpl_id.id,
|
||||
@@ -615,16 +779,18 @@ class ResMrpBomMo(models.Model):
|
||||
# 坯料BOM组件:选取当前坯料原材料,
|
||||
# 然后根据当前的坯料的体积得出需要的原材料重量(立方米m³) *材料密度 * 1000 = 所需原材料重量KG(公斤)
|
||||
# 坯料所需原材料公式:当前的坯料的体积(立方米m³) *材料密度 * 1000 = 所需原材料重量KG(公斤)
|
||||
|
||||
def bom_create_line(self, embryo):
|
||||
# 选取当前坯料原材料
|
||||
raw_bom_line = self.get_raw_bom(embryo)
|
||||
if raw_bom_line:
|
||||
qty = 1
|
||||
if round(embryo.volume * raw_bom_line.materials_type_id.density / 1000000) > 1:
|
||||
qty = round(embryo.volume * raw_bom_line.materials_type_id.density / 1000000)
|
||||
bom_line = self.env['mrp.bom.line'].create({
|
||||
'bom_id': self.id,
|
||||
'product_id': raw_bom_line.id,
|
||||
'product_tmpl_id': raw_bom_line.product_tmpl_id.id,
|
||||
'product_qty': round(embryo.volume * raw_bom_line.materials_type_id.density / 1000000),
|
||||
'product_qty': qty,
|
||||
'product_uom_id': raw_bom_line.uom_id.id,
|
||||
})
|
||||
return bom_line
|
||||
@@ -659,8 +825,7 @@ class ResMrpBomMo(models.Model):
|
||||
else:
|
||||
return
|
||||
|
||||
# 查bom的原材料
|
||||
|
||||
# 查bom的原材料
|
||||
def get_raw_bom(self, product):
|
||||
raw_bom = self.env['product.product'].search(
|
||||
[('categ_id.type', '=', '原材料'), ('materials_type_id', '=', product.materials_type_id.id)])
|
||||
|
||||
@@ -7,7 +7,7 @@ from odoo.exceptions import ValidationError, UserError
|
||||
import requests
|
||||
import json
|
||||
from re import findall as regex_findall
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from re import split as regex_split
|
||||
from odoo import SUPERUSER_ID, _, api, fields, models
|
||||
from odoo.tools import float_compare
|
||||
@@ -154,6 +154,7 @@ class StockRule(models.Model):
|
||||
'''创建制造订单'''
|
||||
productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
|
||||
productions_values)
|
||||
|
||||
self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
|
||||
self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||
'''
|
||||
@@ -188,6 +189,28 @@ class StockRule(models.Model):
|
||||
'mail.message_origin_link',
|
||||
values={'self': production, 'origin': origin_production},
|
||||
subtype_id=self.env.ref('mail.mt_note').id)
|
||||
'''
|
||||
创建生产计划
|
||||
'''
|
||||
# 工单耗时
|
||||
workorder_duration = 0
|
||||
for workorder in production.workorder_ids:
|
||||
workorder_duration += workorder.duration_expected
|
||||
|
||||
sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
|
||||
if sale_order:
|
||||
bb = sale_order.deadline_of_delivery
|
||||
productions = self.env['sf.production.plan'].with_user(SUPERUSER_ID).sudo().with_company(company_id). \
|
||||
create({
|
||||
'name': production.name,
|
||||
'production_id': production.id,
|
||||
'date_planned_start': production.date_planned_start,
|
||||
'origin': production.origin,
|
||||
'product_qty': production.product_qty,
|
||||
'product_id': production.product_id.id,
|
||||
'state': 'draft',
|
||||
})
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@@ -425,6 +448,7 @@ class ReStockMove(models.Model):
|
||||
'tool_height': item.product_id.tool_height,
|
||||
'tool_thickness': item.product_id.tool_thickness,
|
||||
'tool_weight': item.product_id.tool_weight,
|
||||
'tool_hardness': item.product_id.tool_hardness,
|
||||
'coating_material': item.product_id.coating_material,
|
||||
'amount': int(item.quantity_done),
|
||||
# 'model_file': '' if not item.product_id.fixture_model_file else base64.b64encode(
|
||||
@@ -433,8 +457,19 @@ class ReStockMove(models.Model):
|
||||
'total_length': item.product_id.cutting_tool_total_length,
|
||||
'shank_length': item.product_id.cutting_tool_shank_length,
|
||||
'blade_length': item.product_id.cutting_tool_blade_length,
|
||||
'neck_length': item.product_id.cutting_tool_neck_length,
|
||||
'neck_diameter': item.product_id.cutting_tool_neck_diameter,
|
||||
'shank_diameter': item.product_id.cutting_tool_shank_diameter,
|
||||
'blade_tip_diameter': item.product_id.cutting_tool_blade_tip_diameter,
|
||||
'blade_tip_taper': item.product_id.cutting_tool_blade_tip_taper,
|
||||
'blade_helix_angle': item.product_id.cutting_tool_blade_helix_angle,
|
||||
'blade_type': item.product_id.cutting_tool_blade_type,
|
||||
'coarse_medium_fine': '' if item.product_id.cutting_tool_coarse_medium_fine is False else item.product_id.cutting_tool_coarse_medium_fine,
|
||||
'run_out_accuracy_max': item.product_id.cutting_tool_run_out_accuracy_max,
|
||||
'run_out_accuracy_min': item.product_id.cutting_tool_run_out_accuracy_min,
|
||||
'head_diameter': item.product_id.cutting_tool_head_diameter,
|
||||
'diameter': item.product_id.cutting_tool_diameter,
|
||||
'blade_number': item.product_id.cutting_tool_blade_number,
|
||||
'blade_number': '' if item.product_id.cutting_tool_blade_number is False else item.product_id.cutting_tool_blade_number,
|
||||
'front_angle': item.product_id.cutting_tool_front_angle,
|
||||
'rear_angle': item.product_id.cutting_tool_rear_angle,
|
||||
'main_included_angle': item.product_id.cutting_tool_main_included_angle,
|
||||
@@ -449,14 +484,36 @@ class ReStockMove(models.Model):
|
||||
'working_hardness': item.product_id.cutting_tool_working_hardness,
|
||||
'blade_diameter': item.product_id.cutting_tool_blade_diameter,
|
||||
'wrench': item.product_id.cutting_tool_wrench,
|
||||
'screw': item.product_id.cutting_tool_screw,
|
||||
'accuracy_level': item.product_id.cutting_tool_accuracy_level,
|
||||
'clamping_way': item.product_id.cutting_tool_clamping_way,
|
||||
'clamping_length': item.product_id.cutting_tool_clamping_length,
|
||||
'clamping_tolerance': item.product_id.cutting_tool_clamping_tolerance,
|
||||
'diameter_max': item.product_id.cutting_tool_diameter_max,
|
||||
'clamping_diameter': item.product_id.cutting_tool_clamping_diameter,
|
||||
'clamping_diameter_min': item.product_id.cutting_tool_clamping_diameter_min,
|
||||
'clamping_diameter_max': item.product_id.cutting_tool_clamping_diameter_max,
|
||||
'detection_accuracy_max': item.product_id.cutting_tool_detection_accuracy_max,
|
||||
'detection_accuracy_min': item.product_id.cutting_tool_detection_accuracy_min,
|
||||
'is_rough_finish': item.product_id.cutting_tool_is_rough_finish,
|
||||
'is_finish': item.product_id.cutting_tool_is_finish,
|
||||
'is_drill_hole': item.product_id.cutting_tool_is_drill_hole,
|
||||
'is_safety_lock': item.product_id.cutting_tool_is_safety_lock,
|
||||
'is_high_speed_cutting': item.product_id.cutting_tool_is_high_speed_cutting,
|
||||
'dynamic_balance_class': item.product_id.cutting_tool_dynamic_balance_class,
|
||||
'change_time': item.product_id.cutting_tool_change_time,
|
||||
'standard_speed': item.product_id.cutting_tool_standard_speed,
|
||||
'speed_max': item.product_id.cutting_tool_speed_max,
|
||||
'cooling_type': item.product_id.cutting_tool_cooling_type,
|
||||
'body_accuracy': item.product_id.cutting_tool_body_accuracy,
|
||||
'apply_lock_nut_model': item.product_id.apply_lock_nut_model,
|
||||
'apply_lock_wrench_model': item.product_id.apply_lock_wrench_model,
|
||||
'tool_taper': item.product_id.cutting_tool_taper,
|
||||
'flange_length': item.product_id.cutting_tool_flange_length,
|
||||
'flange_diameter': item.product_id.cutting_tool_flange_diameter,
|
||||
'outer_diameter': item.product_id.cutting_tool_outer_diameter,
|
||||
'inner_diameter': item.product_id.cutting_tool_inner_diameter,
|
||||
'cooling_suit_type_ids': item.product_id.cooling_suit_type_ids,
|
||||
'er_size_model': item.product_id.cutting_tool_er_size_model,
|
||||
'image': '' if not item.product_id.image_1920 else base64.b64encode(item.product_id.image_1920).decode('utf-8'),
|
||||
}
|
||||
try:
|
||||
if item.product_id.industry_code:
|
||||
@@ -489,5 +546,3 @@ class ReStockQuant(models.Model):
|
||||
elif self.product_id.categ_type == '刀具':
|
||||
stock._register_cutting_tool()
|
||||
return True
|
||||
|
||||
|
||||
|
||||
94
sf_manufacturing/models/tool_other_features.py
Normal file
94
sf_manufacturing/models/tool_other_features.py
Normal file
@@ -0,0 +1,94 @@
|
||||
from odoo import fields, models, api
|
||||
|
||||
|
||||
class SuitableMachiningMethod(models.Model):
|
||||
_name = 'sf.suitable.machining.method'
|
||||
_description = '适合加工方式'
|
||||
|
||||
name = fields.Char('名称')
|
||||
image = fields.Image('图片')
|
||||
|
||||
|
||||
class BladeTipCharacteristics(models.Model):
|
||||
_name = 'sf.blade.tip.characteristics'
|
||||
_description = '刀尖特征'
|
||||
|
||||
name = fields.Char('名称')
|
||||
image = fields.Image('图片')
|
||||
|
||||
|
||||
class HandleType(models.Model):
|
||||
_name = 'sf.handle.type'
|
||||
_description = '柄部类型'
|
||||
|
||||
name = fields.Char('名称')
|
||||
image = fields.Image('图片')
|
||||
|
||||
|
||||
class CuttingDirection(models.Model):
|
||||
_name = 'sf.cutting.direction'
|
||||
_description = '走刀方向'
|
||||
|
||||
name = fields.Char('名称')
|
||||
image = fields.Image('图片')
|
||||
|
||||
|
||||
class SuitableCoolant(models.Model):
|
||||
_name = 'sf.suitable.coolant'
|
||||
_description = '适合冷却液'
|
||||
|
||||
name = fields.Char('名称')
|
||||
image = fields.Image('图片')
|
||||
|
||||
|
||||
class CuttingSpeed(models.Model):
|
||||
_name = 'sf.cutting.speed'
|
||||
_description = '切削速度Vc'
|
||||
|
||||
# def _get_order(self):
|
||||
# last_tool = self.search([], order='id desc', limit=1)
|
||||
# if last_tool:
|
||||
# last_order = int(last_tool.order)
|
||||
# new_order = last_order + 1
|
||||
# else:
|
||||
# new_order = '1'
|
||||
# return new_order
|
||||
#
|
||||
# order = fields.Char('序', default=_get_order, readonly=True)
|
||||
|
||||
product_template_id = fields.Many2one('product.template', string='产品')
|
||||
|
||||
execution_standard_id = fields.Char('执行标准')
|
||||
material_code = fields.Char('材料代号')
|
||||
material_name = fields.Char('材料名称')
|
||||
material_grade = fields.Char('材料牌号')
|
||||
tensile_strength = fields.Float('拉伸强度 (N/mm²)')
|
||||
hardness = fields.Float('硬度(HRC)')
|
||||
|
||||
cutting_speed_n1 = fields.Char('径向切宽 ae=100%D1 ap=1*D1 切削速度Vc')
|
||||
cutting_speed_n2 = fields.Char('径向切宽 ae=50%D1 ap=1.5*D1 切削速度Vc')
|
||||
cutting_speed_n3 = fields.Char('径向切宽 ae=25%D1 ap=L1max 切削速度Vc')
|
||||
cutting_speed_n4 = fields.Char('径向切宽 ae=15%D1 ap=L1max 切削速度Vc')
|
||||
cutting_speed_n5 = fields.Char('径向切宽 ae=5%D1 ap=L1max 切削速度Vc')
|
||||
rough_machining = fields.Char('粗加工 Vc(m/min)')
|
||||
precision_machining = fields.Char('精加工 Vc(m/min)')
|
||||
application = fields.Selection([('主应用', '主应用'), ('次应用', '次应用')], '主/次应用')
|
||||
|
||||
|
||||
class FeedPerTooth(models.Model):
|
||||
_name = 'sf.feed.per.tooth'
|
||||
_description = '每齿走刀量fz'
|
||||
|
||||
product_template_id = fields.Many2one('product.template', string='产品')
|
||||
|
||||
cutting_speed = fields.Char('径向切宽 ae(mm)')
|
||||
machining_method = fields.Selection([('直铣', '直铣'), ('坡铣', '坡铣')], string='加工方式')
|
||||
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
|
||||
blade_diameter = fields.Float('刃部直径D1(mm)', readonly=True, compute='_compute_product_template_id')
|
||||
feed_per_tooth = fields.Char('每齿走刀量 (mm/z)')
|
||||
unit = fields.Char('单位', default='fz')
|
||||
|
||||
@api.depends('product_template_id')
|
||||
def _compute_product_template_id(self):
|
||||
if self.product_template_id is not None:
|
||||
self.blade_diameter = self.product_template_id.cutting_tool_blade_diameter
|
||||
@@ -7,6 +7,12 @@ access_sf_surface_technics_model_type_routing_sort,sf_surface_technics_model_typ
|
||||
|
||||
access_sf_production_line,sf.production.line,model_sf_production_line,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
access_sf_suitable_machining_method,sf_suitable_machining_method,model_sf_suitable_machining_method,base.group_user,1,1,1,1
|
||||
access_sf_blade_tip_characteristics,sf_blade_tip_characteristics,model_sf_blade_tip_characteristics,base.group_user,1,1,1,1
|
||||
access_sf_handle_type,sf_handle_type,model_sf_handle_type,base.group_user,1,1,1,1
|
||||
access_sf_cutting_direction,sf_cutting_direction,model_sf_cutting_direction,base.group_user,1,1,1,1
|
||||
access_sf_suitable_coolant,sf_suitable_coolant,model_sf_suitable_coolant,base.group_user,1,1,1,1
|
||||
access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,base.group_user,1,1,1,1
|
||||
access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
||||
|
@@ -20,8 +20,10 @@
|
||||
<xpath expr="//field[@name='product_qty']" position="after">
|
||||
<field name="product_uom_id" string="计量单位" options="{'no_open':True,'no_create':True}" groups="uom.group_uom" optional="show"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='date_planned_start']" position="after">
|
||||
<field name="date_deadline" widget="remaining_days" attrs="{'invisible': [('state', 'in', ['done', 'cancel'])]}" optional="show"/>
|
||||
<xpath expr="//field[@name='date_planned_start']" position="replace">
|
||||
<field name="date_planned_start" optional="show"/>
|
||||
<field name="date_planned_finished" string="计划结束时间"/>
|
||||
<!-- <field name="date_deadline" widget="remaining_days" attrs="{'invisible': [('state', 'in', ['done', 'cancel'])]}" optional="show"/> -->
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='production_real_duration']" position="after">
|
||||
<field name="reservation_state" optional="hide" decoration-danger="reservation_state == 'confirmed'" decoration-success="reservation_state == 'assigned'"/>
|
||||
@@ -40,7 +42,64 @@
|
||||
decoration-warning="reservation_state != 'assigned' and components_availability_state in ('expected', 'available')"
|
||||
decoration-danger="reservation_state != 'assigned' and components_availability_state == 'late'"/>
|
||||
</xpath>
|
||||
<!-- <xpath expr="//field[@name='state']" position="after"> -->
|
||||
<!-- <button name="action_view_production_schedule" string="生产排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','已排程','progress','done','to_close'])]}"/> -->
|
||||
<!-- <button name="cancel_plan" string="取消排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','progress','done','to_close','confirmed'])]}"/> -->
|
||||
<!-- </xpath> -->
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- <record id="custom_mrp_production_form_view" model="ir.ui.view"> -->
|
||||
<!-- <field name="name">custom.mrp.production.form</field> -->
|
||||
<!-- <field name="model">mrp.production</field> -->
|
||||
<!-- <field name="inherit_id" ref="mrp.mrp_production_form_view"/> -->
|
||||
<!-- <field name="arch" type="xml"> -->
|
||||
<!-- <xpath expr="//header//field[@name='state']" position="replace"> -->
|
||||
<!-- <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,已排程,progress,done"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//header" position="inside"> -->
|
||||
<!-- <button name="action_view_production_schedule" string="生产排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','已排程','progress','done','to_close'])]}"/> -->
|
||||
<!-- <button name="cancel_plan" string="取消排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','progress','done','to_close','confirmed'])]}"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//sheet//group//group//field[@name='product_id']" position="after"> -->
|
||||
<!-- <field name="production_line_id"/> -->
|
||||
<!-- <field name="date_planned_finished" string="计划结束时间"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//sheet//group//group//field[@name='date_planned_start']" position="after"> -->
|
||||
<!-- <field name="date_planned_finished"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- </field> -->
|
||||
<!-- </record> -->
|
||||
|
||||
<record id="custom_view_mrp_production_filter" model="ir.ui.view">
|
||||
<field name="name">custom.mrp.production.select</field>
|
||||
<field name="model">mrp.production</field>
|
||||
<field name="inherit_id" ref="mrp.view_mrp_production_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//search" position="inside">
|
||||
<searchpanel class="account_root">
|
||||
<field name="state" icon="fa-filter"/>
|
||||
</searchpanel>
|
||||
</xpath>
|
||||
<filter name='todo' position="replace"/>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- <xpath expr="//filter[@name='filter_draft']" position="after"> -->
|
||||
<!-- <filter string="已完成" name="filter_done" domain="[('state', '=', 'done')]"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//filter[@name='filter_draft']" position="after"> -->
|
||||
<!-- <filter string="已取消" name="filter_cancel" domain="[('state', '=', 'cancel')]"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//filter[@name='filter_draft']" position="after"> -->
|
||||
<!-- <filter string="进行中" name="filter_progress" domain="[('state', '=', 'progress')]"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//filter[@name='filter_draft']" position="after"> -->
|
||||
<!-- <filter string="已确认" name="filter_confirmed" domain="[('state', '=', 'confirmed')]"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//filter[@name='filter_draft']" position="after"> -->
|
||||
<!-- <filter string="草稿" name="filter_draft" domain="[('state', '=', 'draft')]"/> -->
|
||||
<!-- </xpath> -->
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -43,6 +43,12 @@
|
||||
<field name="equipment_image" widget="image" />
|
||||
|
||||
|
||||
</xpath>
|
||||
<xpath expr='(//a[@name="unblock"])' position="after">
|
||||
|
||||
<div class="czyg">绿色:正常,红色:故障,黄色:下线/暂停</div>
|
||||
|
||||
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -451,11 +451,11 @@
|
||||
<field name="domain">[('schedule_state', '=', '已排')]</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_mrp_workorder_schedule_todo"
|
||||
name="工单"
|
||||
action="mrp_workorder_action_schedule"
|
||||
parent="mrp.menu_mrp_manufacturing"
|
||||
sequence="15"/>
|
||||
<!-- <menuitem id="menu_mrp_workorder_schedule_todo" -->
|
||||
<!-- name="工单" -->
|
||||
<!-- action="mrp_workorder_action_schedule" -->
|
||||
<!-- parent="mrp.menu_mrp_manufacturing" -->
|
||||
<!-- sequence="15"/> -->
|
||||
|
||||
<record id="mrp.menu_mrp_workorder_todo" model="ir.ui.menu">
|
||||
<field name="active" eval="False"/>
|
||||
|
||||
158
sf_manufacturing/views/tool_other_features_view.xml
Normal file
158
sf_manufacturing/views/tool_other_features_view.xml
Normal file
@@ -0,0 +1,158 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- ======================================== 适合加工方式========================================-->
|
||||
<record model="ir.ui.view" id="sf_suitable_machining_method_tree">
|
||||
<field name="name">适合加工方式</field>
|
||||
<field name="model">sf.suitable.machining.method</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_suitable_machining_method_act" model="ir.actions.act_window">
|
||||
<field name="name">适合加工方式</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.suitable.machining.method</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 刀尖特征========================================-->
|
||||
<record model="ir.ui.view" id="sf_blade_tip_characteristics_tree">
|
||||
<field name="name">刀尖特征</field>
|
||||
<field name="model">sf.blade.tip.characteristics</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_blade_tip_characteristics_act" model="ir.actions.act_window">
|
||||
<field name="name">刀尖特征</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.blade.tip.characteristics</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 柄部类型========================================-->
|
||||
<record model="ir.ui.view" id="sf_handle_type_tree">
|
||||
<field name="name">柄部类型</field>
|
||||
<field name="model">sf.handle.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_handle_type_act" model="ir.actions.act_window">
|
||||
<field name="name">柄部类型</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.handle.type</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 走刀方向========================================-->
|
||||
<record model="ir.ui.view" id="sf_cutting_direction_tree">
|
||||
<field name="name">走刀方向</field>
|
||||
<field name="model">sf.cutting.direction</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_cutting_direction_act" model="ir.actions.act_window">
|
||||
<field name="name">走刀方向</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.cutting.direction</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 适合冷却液========================================-->
|
||||
<record model="ir.ui.view" id="sf_suitable_coolant_tree">
|
||||
<field name="name">适合冷却液</field>
|
||||
<field name="model">sf.suitable.coolant</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="image" widget="image"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_suitable_coolant_act" model="ir.actions.act_window">
|
||||
<field name="name">适合冷却液</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.suitable.coolant</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 切削速度Vc========================================-->
|
||||
<record id="sf_cutting_speed_tree" model="ir.ui.view">
|
||||
<field name="name">切削速度Vc</field>
|
||||
<field name="model">sf.cutting.speed</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="切削速度Vc" create="1">
|
||||
<!-- <field name="order"/>-->
|
||||
<field name="execution_standard_id"/>
|
||||
<field name="material_code"/>
|
||||
<field name="material_name"/>
|
||||
<field name="material_grade"/>
|
||||
<field name="tensile_strength"/>
|
||||
<field name="hardness"/>
|
||||
<field name="cutting_speed_n1"/>
|
||||
<field name="cutting_speed_n2"/>
|
||||
<field name="cutting_speed_n3"/>
|
||||
<field name="cutting_speed_n4"/>
|
||||
<field name="cutting_speed_n5"/>
|
||||
<field name="rough_machining"/>
|
||||
<field name="precision_machining"/>
|
||||
<field name="application"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_cutting_speed_act" model="ir.actions.act_window">
|
||||
<field name="name">切削速度Vc</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.cutting.speed</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 每齿走刀量fz========================================-->
|
||||
<record model="ir.ui.view" id="sf_feed_per_tooth_tree">
|
||||
<field name="name">每齿走刀量fz</field>
|
||||
<field name="model">sf.feed.per.tooth</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="cutting_speed" attrs="{'readonly': [('materials_type_id','!=',False)]}"/>
|
||||
<field name="machining_method" attrs="{'readonly': [('cutting_speed','!=',False)]}"/>
|
||||
<field name="materials_type_id" attrs="{'readonly': [('cutting_speed','!=',False)]}"/>
|
||||
<field name="blade_diameter"/>
|
||||
<field name="feed_per_tooth"/>
|
||||
<field name="unit"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_feed_per_tooth_act" model="ir.actions.act_window">
|
||||
<field name="name">每齿走刀量fz</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.feed.per.tooth</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -2,3 +2,4 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
from . import controllers
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
'author': 'jikimo',
|
||||
'website': 'https://sf.cs.jikimo.com',
|
||||
# 此处依赖sf_manufacturing是因为我要重写其中的一个字段operation_id的string,故需要sf_manufacturing先安装
|
||||
'depends': ['mrp', 'mrp_workorder'],
|
||||
'depends': ['sf_manufacturing'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'views/view.xml'
|
||||
@@ -24,7 +24,8 @@
|
||||
'web.assets_qweb': [
|
||||
],
|
||||
'web.assets_backend': [
|
||||
'sf_plan/static/src/scss/gannt_change.scss'
|
||||
'sf_plan/static/src/scss/gannt_change.scss',
|
||||
'sf_plan/static/src/css/button_color.css'
|
||||
],
|
||||
|
||||
},
|
||||
|
||||
2
sf_plan/controllers/__init__.py
Normal file
2
sf_plan/controllers/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from .import controllers
|
||||
|
||||
17
sf_plan/controllers/controllers.py
Normal file
17
sf_plan/controllers/controllers.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import json
|
||||
import logging
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
class ProductionPlan(http.Controller):
|
||||
|
||||
@http.route('/api/production/plan', type='http', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def schedule_orders(self, **kw):
|
||||
"""
|
||||
排程订单
|
||||
"""
|
||||
logging.info('schedule_orders', kw)
|
||||
|
||||
@@ -1,25 +1,88 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import json, requests
|
||||
from odoo import models, fields, api, _
|
||||
from datetime import datetime, timedelta
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
|
||||
# sf坯料预制排程
|
||||
class sf_pl_plan(models.Model):
|
||||
_name = 'sf.pl.plan'
|
||||
_description = 'sf_pl_plan'
|
||||
# sf排程
|
||||
class sf_production_plan(models.Model):
|
||||
_name = 'sf.production.plan'
|
||||
# _inherit = 'mrp.production'
|
||||
_description = 'sf_production_plan'
|
||||
|
||||
name = fields.Char(string='名称')
|
||||
# selected = fields.Boolean(default=False)
|
||||
production_id = fields.Many2one('mrp.production', '关联制造订单')
|
||||
product_qty = fields.Float(string='数量', digits='Product Unit of Measure', required=True, default=0.0)
|
||||
date_planned_start = fields.Datetime(string='计划开始时间', required=True, index=True, copy=False,
|
||||
default=fields.Datetime.now)
|
||||
date_planned_finished = fields.Datetime(string='计划结束时间')
|
||||
state = fields.Selection([
|
||||
('draft', '未排程'), ('done', '已排程')], string='状态', copy=False, index=True, readonly=True,
|
||||
store=True, tracking=True)
|
||||
product_id = fields.Many2one('product.product', '关联产品')
|
||||
origin = fields.Char(string='来源')
|
||||
|
||||
name = fields.Char(string='名称', size=64)
|
||||
# 序号、坯料编号、坯料名称、材质、数量、长度、宽度、厚度、直径、计划开始时间、计划结束时间、状态(已产出与待产出)、操作、创建人、创建时间、客户名称、订单号、行号、长度、宽度、厚度、直径、交货数量、交货日期
|
||||
# sequence = fields.Integer(string='序号', required=True, copy=False, readonly=True, index=True,
|
||||
# default=lambda self: self.env['ir.sequence'].sudo().next_by_code('sf.pl.plan'))
|
||||
sequence = fields.Integer(string='序号', required=True, copy=False, readonly=True, index=True)
|
||||
current_operation_name = fields.Char(string='当前工序名称', size=64, default='坯料预制')
|
||||
sequence = fields.Integer(string='序号', copy=False, readonly=True, index=True)
|
||||
current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划')
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线')
|
||||
|
||||
# state = fields.Selection([
|
||||
# ('未排程', '未排程'), ('已排程', '已排程')], string='State', copy=False, index=True, readonly=True,
|
||||
# store=True, tracking=True)
|
||||
|
||||
# orderpoint_id = fields.Many2one('stock.warehouse.orderpoint', compute='_compute_orderpoint_id')
|
||||
# location_src_id = fields.Many2one('stock.location', 'Components Location', compute='_compute_orderpoint_id', active=False)
|
||||
# location_dest_id = fields.Many2one('stock.location', 'Finished Products Location', compute='_compute_orderpoint_id')
|
||||
# picking_type_id = fields.Many2one('stock.picking.type', 'Operation Type', compute='_compute_orderpoint_id')
|
||||
# move_dest_ids = fields.One2many('stock.move', 'created_production_id', compute='_compute_orderpoint_id')
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if 'sequence' not in vals:
|
||||
vals['sequence'] = self.env['sf.pl.plan'].search_count([]) + 1
|
||||
return super().create(vals)
|
||||
def _compute_orderpoint_id(self):
|
||||
pass
|
||||
|
||||
def test_sale_order(self):
|
||||
company_id = self.env.ref('base.main_company').sudo()
|
||||
date = datetime.today()
|
||||
aaa = self.env['sale.order'].with_user(self.env.ref("base.user_admin")).sale_order_create(
|
||||
company_id, 'delivery_name', 'delivery_telephone', 'delivery_address',
|
||||
date)
|
||||
print('aaa', aaa)
|
||||
|
||||
# 当不设置计划结束时间时,增加计算计划结束时间的方法,根据采购周期加缓冲期两个值来算就可以了
|
||||
def action_view_production_schedule(self):
|
||||
self.ensure_one()
|
||||
if self.date_planned_start and self.date_planned_finished:
|
||||
return None
|
||||
elif self.date_planned_start and not self.date_planned_finished:
|
||||
# 如果没有给出计划结束时间,则计划结束时间为计划开始时间+采购周期+缓冲期
|
||||
# 采购周期
|
||||
purchase_cycle = 3
|
||||
# 缓冲期
|
||||
buffer_period = 1
|
||||
# 计划结束时间 = 计划开始时间 + 采购周期 + 缓冲期
|
||||
self.date_planned_finished = self.date_planned_start + timedelta(days=purchase_cycle) + timedelta(
|
||||
days=buffer_period)
|
||||
self.state = '已排程'
|
||||
return self.date_planned_finished
|
||||
else:
|
||||
return None
|
||||
|
||||
def cancel_plan(self):
|
||||
self.ensure_one()
|
||||
self.date_planned_finished = None
|
||||
self.state = 'draft'
|
||||
|
||||
# @api.model
|
||||
# def create(self, vals):
|
||||
# if 'sequence' not in vals:
|
||||
# vals['sequence'] = self.env['sf.production.plan'].search_count([]) + 1
|
||||
# return super().create(vals)
|
||||
|
||||
def unlink(self):
|
||||
sequence_to_reorder = self.mapped('sequence')
|
||||
@@ -31,7 +94,7 @@ class sf_pl_plan(models.Model):
|
||||
|
||||
# 生成编码
|
||||
def _get_pl_no(self):
|
||||
sf_pl_no = self.env['sf.pl.plan'].sudo().search(
|
||||
sf_pl_no = self.env['sf.production.plan'].sudo().search(
|
||||
[('pl_no', '!=', '')],
|
||||
limit=1,
|
||||
order="id desc")
|
||||
@@ -55,81 +118,161 @@ class sf_pl_plan(models.Model):
|
||||
|
||||
return num
|
||||
|
||||
pl_no = fields.Char(string='坯料编号', required=True, default=_get_pl_no, readonly=True)
|
||||
pl_name = fields.Char(string='坯料名称', size=64, required=True)
|
||||
material = fields.Many2one('sf.production.materials', string='材质', required=True)
|
||||
quantity = fields.Float(string='数量', required=True)
|
||||
length = fields.Float(string='长度', required=True)
|
||||
width = fields.Float(string='宽度', required=True)
|
||||
thickness = fields.Float(string='厚度', required=True)
|
||||
diameter = fields.Float(string='直径', required=True)
|
||||
plan_start_time = fields.Datetime(string='计划开始时间')
|
||||
plan_end_time = fields.Datetime(string='计划结束时间')
|
||||
state = fields.Selection([
|
||||
('draft', '待产出'),
|
||||
('produce', '已产出'),
|
||||
], string='状态', copy=False, index=True, default='draft')
|
||||
customer_name = fields.Char(string='客户名称', size=64)
|
||||
order_no = fields.Char(string='订单号', size=64)
|
||||
line_no = fields.Char(string='行号', size=64)
|
||||
delivery_length = fields.Float(string='交货长度')
|
||||
delivery_width = fields.Float(string='交货宽度')
|
||||
delivery_thickness = fields.Float(string='交货厚度')
|
||||
delivery_diameter = fields.Float(string='交货直径')
|
||||
delivery_quantity = fields.Float(string='交货数量')
|
||||
delivery_date = fields.Datetime(string='交货日期', related='plan_end_time', readonly=False, store=True)
|
||||
# pl_no = fields.Char(string='坯料编号', required=True, default=_get_pl_no, readonly=True)
|
||||
# pl_name = fields.Char(string='坯料名称', size=64, required=True)
|
||||
# material = fields.Many2one('sf.production.materials', string='材质', required=True)
|
||||
# quantity = fields.Float(string='数量', required=True)
|
||||
# length = fields.Float(string='长度', required=True)
|
||||
# width = fields.Float(string='宽度', required=True)
|
||||
# thickness = fields.Float(string='厚度', required=True)
|
||||
# diameter = fields.Float(string='直径', required=True)
|
||||
# plan_start_time = fields.Datetime(string='计划开始时间')
|
||||
# plan_end_time = fields.Datetime(string='计划结束时间')
|
||||
# state = fields.Selection([
|
||||
# ('draft', '待排程'),
|
||||
# ('produce', '已排程'),
|
||||
# ('done', '已产出'),
|
||||
# ], string='状态', copy=False, index=True, default='draft')
|
||||
# customer_name = fields.Char(string='客户名称', size=64)
|
||||
# order_no = fields.Char(string='订单号', size=64)
|
||||
# line_no = fields.Char(string='行号', size=64)
|
||||
# delivery_length = fields.Float(string='交货长度')
|
||||
# delivery_width = fields.Float(string='交货宽度')
|
||||
# delivery_thickness = fields.Float(string='交货厚度')
|
||||
# delivery_diameter = fields.Float(string='交货直径')
|
||||
# delivery_quantity = fields.Float(string='交货数量')
|
||||
# delivery_date = fields.Datetime(string='交货日期', related='plan_end_time', readonly=False, store=True)
|
||||
|
||||
# 当不设置计划结束时间时,增加计算计划结束时间的方法,根据采购周期加缓冲期两个值来算就可以了
|
||||
def get_plan_end_time(self):
|
||||
if self.plan_start_time and self.plan_end_time:
|
||||
return None
|
||||
elif self.plan_start_time and not self.plan_end_time:
|
||||
# 如果没有给出计划结束时间,则计划结束时间为计划开始时间+采购周期+缓冲期
|
||||
# 采购周期
|
||||
purchase_cycle = 3
|
||||
# 缓冲期
|
||||
buffer_period = 1
|
||||
# 计划结束时间 = 计划开始时间 + 采购周期 + 缓冲期
|
||||
self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(days=buffer_period)
|
||||
return self.plan_end_time
|
||||
def do_production_schedule(self):
|
||||
if not self.production_line_id:
|
||||
raise ValidationError("未选择生产线")
|
||||
else:
|
||||
return None
|
||||
# 后面要补充计划开始时间的计算方法
|
||||
# # 坯料预制时间
|
||||
# # pl_time = 0.5
|
||||
# # 采购周期
|
||||
# purchase_cycle = 3
|
||||
# # 缓冲期
|
||||
# buffer_period = 1
|
||||
# # 计划结束时间 = 计划开始时间 + 坯料预制时间 + 采购周期 + 缓冲期
|
||||
# # plan_end_time = plan_start_time + pl_time + purchase_cycle + buffer_period
|
||||
# # 计划结束时间 = 计划开始时间(是一个datatime) + 采购周期(Float) + 缓冲期(Float)
|
||||
# self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(days=buffer_period)
|
||||
# return self.plan_end_time
|
||||
aa = self.env['mrp.production'].sudo().search([('name', '=', self.name)])
|
||||
workorder_time = 0
|
||||
print(aa.workorder_ids)
|
||||
print(type(aa.workorder_ids))
|
||||
if aa.workorder_ids:
|
||||
for item in aa.workorder_ids:
|
||||
current_workorder = self.env['mrp.workorder'].sudo().search([('id', '=', item.id)])
|
||||
workorder_time += current_workorder.duration_expected
|
||||
print(workorder_time)
|
||||
self.date_planned_finished = self.date_planned_start + timedelta(minutes=workorder_time)
|
||||
self.state = 'done'
|
||||
else:
|
||||
self.date_planned_finished = self.date_planned_start + timedelta(days=3)
|
||||
self.state = 'done'
|
||||
return {
|
||||
'name': '排程甘特图',
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'sf.production.plan', # 要跳转的模型名称
|
||||
'view_mode': 'gantt,tree,form', # 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等
|
||||
'target': 'current', # 跳转的目标窗口,可以是'current'或'new'
|
||||
}
|
||||
# if self.production_line_id:
|
||||
# if self.plan_start_time and self.plan_end_time:
|
||||
# return None
|
||||
# elif self.plan_start_time and not self.plan_end_time:
|
||||
# # 如果没有给出计划结束时间,则计划结束时间为计划开始时间+采购周期+缓冲期
|
||||
# # 采购周期
|
||||
# purchase_cycle = 3
|
||||
# # 缓冲期
|
||||
# buffer_period = 1
|
||||
# # 计划结束时间 = 计划开始时间 + 采购周期 + 缓冲期
|
||||
# self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(
|
||||
# days=buffer_period)
|
||||
# self.state = 'produce'
|
||||
# return self.plan_end_time
|
||||
# else:
|
||||
# return None
|
||||
# # 后面要补充计划开始时间的计算方法
|
||||
# # # 坯料预制时间
|
||||
# # # pl_time = 0.5
|
||||
# # # 采购周期
|
||||
# # purchase_cycle = 3
|
||||
# # # 缓冲期
|
||||
# # buffer_period = 1
|
||||
# # # 计划结束时间 = 计划开始时间 + 坯料预制时间 + 采购周期 + 缓冲期
|
||||
# # # plan_end_time = plan_start_time + pl_time + purchase_cycle + buffer_period
|
||||
# # # 计划结束时间 = 计划开始时间(是一个datatime) + 采购周期(Float) + 缓冲期(Float)
|
||||
# # self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(days=buffer_period)
|
||||
# # return self.plan_end_time
|
||||
# else:
|
||||
# raise ValidationError('生产线为空!')
|
||||
|
||||
def cancel_production_schedule(self):
|
||||
self.date_planned_finished = False
|
||||
self.state = 'draft'
|
||||
return self.date_planned_finished
|
||||
|
||||
def liucheng_cs(self):
|
||||
res = {'order_number': '123', 'delivery_end_date': str(datetime.now()),
|
||||
'delivery_name': '机企猫', 'delivery_telephone': '18943919239',
|
||||
'delivery_address': '新时空大厦',
|
||||
'bfm_process_order_list': []}
|
||||
aa = self.env['ir.attachment'].search([('id', '=', 631)])
|
||||
temp = self.env['product.template'].search([('id', '=', 47)])
|
||||
item = aa.datas.decode('utf-8')
|
||||
val = {
|
||||
'model_long': 3,
|
||||
'model_width': 1,
|
||||
'model_height': 1,
|
||||
'model_volume': 3,
|
||||
'model_machining_precision': '0.10',
|
||||
'model_name': aa.name,
|
||||
'model_data': base64.b64encode(aa.datas).decode('utf-8'),
|
||||
'model_file': base64.b64encode(temp.model_file).decode('utf-8'),
|
||||
'texture_code': '001',
|
||||
'texture_type_code': '001001',
|
||||
# 'surface_process_code': self.env['jikimo.surface.process']._json_surface_process_code(item),
|
||||
'process_parameters_code': 'R',
|
||||
'price': 20,
|
||||
'number': 2,
|
||||
'total_amount': 100,
|
||||
'remark': '这只是测试',
|
||||
'barcode': 123456789,
|
||||
}
|
||||
res['bfm_process_order_list'].append(val)
|
||||
url = '/api/bfm_process_order/list'
|
||||
res['bfm_process_order_list'] = json.dumps(res['bfm_process_order_list'])
|
||||
try:
|
||||
ret = requests.post(('http://localhost:1069' + url), json={}, data=res)
|
||||
# aa = json.loads(ret.text)
|
||||
print(ret)
|
||||
except Exception as e:
|
||||
raise UserError(e)
|
||||
|
||||
|
||||
# # sf生产排程
|
||||
# class sf_produce_plan(models.Model):
|
||||
# _name = 'sf.produce.plan'
|
||||
# _description = 'sf生产排程'
|
||||
|
||||
# # 重写create方法,使得创建坯料预制排程时,如果给出了计划结束时间,则计划开始时间为计划结束时间减去坯料预制时间
|
||||
# @api.model
|
||||
# def create(self, vals):
|
||||
# # 评估结束时间
|
||||
# vals['plan_end_time'] = self._get_plan_end_time(vals['plan_start_time'], vals['quantity'])
|
||||
# return super(sf_pl_plan, self).create(vals)
|
||||
# # 重写create方法,使得创建坯料预制排程时,如果给出了计划结束时间,则计划开始时间为计划结束时间减去坯料预制时间
|
||||
# @api.model
|
||||
# def create(self, vals):
|
||||
# # 评估结束时间
|
||||
# vals['plan_end_time'] = self._get_plan_end_time(vals['plan_start_time'], vals['quantity'])
|
||||
# return super(sf_pl_plan, self).create(vals)
|
||||
|
||||
# # 当不设置计划结束时间时,增加计算计划结束时间的方法
|
||||
# @api.onchange('plan_start_time', 'quantity')
|
||||
# def _onchange_plan_start_time(self):
|
||||
# if self.plan_start_time and self.quantity:
|
||||
# self.plan_end_time = self._get_plan_end_time(self.plan_start_time, self.quantity)
|
||||
#
|
||||
# # 计算计划结束时间
|
||||
# def _get_plan_end_time(self, plan_start_time, quantity):
|
||||
# # 坯料预制时间
|
||||
# pl_time = 0.5
|
||||
# # 计划结束时间 = 计划开始时间 + 坯料预制时间
|
||||
# plan_end_time = plan_start_time + pl_time
|
||||
# return plan_end_time
|
||||
#
|
||||
# # 当不设置计划结束时间时,增加计算计划结束时间的方法
|
||||
# @api.onchange('plan_start_time', 'quantity')
|
||||
# def _onchange_plan_start_time(self):
|
||||
# if self.plan_start_time and self.quantity:
|
||||
# self.plan_end_time = self._get_plan_end_time(self.plan_start_time, self.quantity)
|
||||
#
|
||||
# # 计算计划结束时间
|
||||
# def _get_plan_end_time(self, plan_start_time, quantity):
|
||||
# # 坯料预制时间
|
||||
# pl_time = 0.5
|
||||
# # 计划结束时间 = 计划开始时间 + 坯料预制时间
|
||||
# plan_end_time = plan_start_time + pl_time
|
||||
# return plan_end_time
|
||||
#
|
||||
|
||||
# 机台作业计划
|
||||
class machine_work_schedule(models.Model):
|
||||
_name = 'sf.machine.schedule'
|
||||
_description = '机台作业计划'
|
||||
|
||||
name = fields.Char(string='机台名')
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_sf_pl_plan,sf.pl.plan,model_sf_pl_plan,base.group_user,1,1,1,1
|
||||
access_sf_production_plan,sf.production.plan,model_sf_production_plan,base.group_user,1,1,1,1
|
||||
access_sf_machine_schedule,sf.machine.schedule,model_sf_machine_schedule,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
||||
|
||||
|
8
sf_plan/static/src/css/button_color.css
Normal file
8
sf_plan/static/src/css/button_color.css
Normal file
@@ -0,0 +1,8 @@
|
||||
.schedule_done {
|
||||
background-color: #69c17d;
|
||||
color: white;
|
||||
}
|
||||
.schedule_cancel {
|
||||
background-color: #ffc54d;
|
||||
color: black;
|
||||
}
|
||||
@@ -1,103 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="sf_pl_plan_tree" model="ir.ui.view">
|
||||
<field name="name">sf.pl.plan.tree</field>
|
||||
<field name="model">sf.pl.plan</field>
|
||||
<record id="sf_production_plan_tree" model="ir.ui.view">
|
||||
<field name="name">sf.production.plan.tree</field>
|
||||
<field name="model">sf.production.plan</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="坯料预制计划">
|
||||
<tree string="订单计划">
|
||||
<!-- <field name="selected" widget="boolean_toggle"/> -->
|
||||
<!-- sequence、pl_no、pl_name、quantity、plan_start_time、plan_end_time、actual_start_time、actual_end_time、state、create_uid、create_date -->
|
||||
<field name="sequence"/>
|
||||
<field name="pl_no"/>
|
||||
<field name="pl_name"/>
|
||||
<field name="quantity"/>
|
||||
<field name="plan_start_time"/>
|
||||
<field name="plan_end_time"/>
|
||||
<field name="state"/>
|
||||
<field name="create_uid" string="创建人"/>
|
||||
<field name="create_date" string="创建时间"/>
|
||||
<!-- <field name="sequence"/> -->
|
||||
<field name="name"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="date_planned_start"/>
|
||||
<field name="date_planned_finished"/>
|
||||
<field name="state" widget="badge" decoration-warning="state == 'draft'" decoration-success="state == 'done'"/>
|
||||
<button name="do_production_schedule" class="btn schedule_done" string="生产排程" type="object" attrs="{'invisible': [('state', 'not in', ['draft'])]}"/>
|
||||
<button name="cancel_production_schedule" class="btn schedule_cancel" string="取消排程" type="object" attrs="{'invisible': [('state', 'not in', ['done'])]}"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_pl_plan_form" model="ir.ui.view">
|
||||
<field name="name">sf.pl.plan.form</field>
|
||||
<field name="model">sf.pl.plan</field>
|
||||
<record id="sf_production_plan_form" model="ir.ui.view">
|
||||
<field name="name">sf.production.plan.form</field>
|
||||
<field name="model">sf.production.plan</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="坯料预制计划">
|
||||
<form string="订单计划">
|
||||
<header>
|
||||
<button string="执行排程" name="get_plan_end_time" type="object" class="oe_highlight"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,produce"/>
|
||||
<!-- <button string="执行排程" name="do_production_schedule" type="object" class="oe_highlight" icon="fa-step-forward"/> -->
|
||||
<button string="执行排程" name="do_production_schedule" type="object" class="oe_highlight"/>
|
||||
<!-- <button string="销售单" name="test_sale_order" type="object" class="oe_highlight"/> -->
|
||||
<!-- <button string="测试流程" name="liucheng_cs" type="object" class="oe_highlight"/> -->
|
||||
<!-- <field name="state" widget="statusbar" statusbar_visible="draft,produce"/> -->
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="pl_no" readonly="1"/>
|
||||
<field name="name" readonly="1"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group string="基本信息">
|
||||
<field name="pl_no"/>
|
||||
<field name="pl_name"/>
|
||||
<field name="quantity"/>
|
||||
<field name="plan_start_time"/>
|
||||
<field name="plan_end_time"/>
|
||||
<field name="production_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="origin"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="date_planned_start"/>
|
||||
<field name="date_planned_finished"/>
|
||||
<field name="state"/>
|
||||
<field name="production_line_id"/>
|
||||
</group>
|
||||
<group string="规格信息" col="1">
|
||||
<group col="3">
|
||||
<group>
|
||||
<field name="length"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="width"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="thickness"/>
|
||||
</group>
|
||||
</group>
|
||||
<!-- <group string="规格信息" col="1"> -->
|
||||
<!-- <group col="3"> -->
|
||||
<!-- <group> -->
|
||||
<!-- <field name="length"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <field name="width"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <field name="thickness"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- </group> -->
|
||||
<!-- <field name="length"/> -->
|
||||
<!-- <field name="width"/> -->
|
||||
<!-- <field name="thickness"/> -->
|
||||
<group>
|
||||
<field name="diameter"/>
|
||||
<field name="material"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="绑定订单">
|
||||
<field name="customer_name"/>
|
||||
<field name="order_no"/>
|
||||
<field name="line_no"/>
|
||||
<field name="delivery_length"/>
|
||||
<field name="delivery_width"/>
|
||||
<field name="delivery_thickness"/>
|
||||
<field name="delivery_diameter"/>
|
||||
<field name="delivery_quantity"/>
|
||||
<field name="delivery_date"/>
|
||||
</group>
|
||||
<!-- <group> -->
|
||||
<!-- <field name="diameter"/> -->
|
||||
<!-- <field name="material"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- </group> -->
|
||||
<!-- <group string="绑定订单"> -->
|
||||
<!-- <field name="customer_name"/> -->
|
||||
<!-- <field name="order_no"/> -->
|
||||
<!-- <field name="line_no"/> -->
|
||||
<!-- <field name="delivery_length"/> -->
|
||||
<!-- <field name="delivery_width"/> -->
|
||||
<!-- <field name="delivery_thickness"/> -->
|
||||
<!-- <field name="delivery_diameter"/> -->
|
||||
<!-- <field name="delivery_quantity"/> -->
|
||||
<!-- <field name="delivery_date"/> -->
|
||||
<!-- </group> -->
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_pl_plan_gantt" model="ir.ui.view">
|
||||
<field name="name">sf.pl.plan.gantt</field>
|
||||
<field name="model">sf.pl.plan</field>
|
||||
<!-- 搜索视图 -->
|
||||
<record id="sf_production_plan_search" model="ir.ui.view">
|
||||
<field name="name">sf.production.plan.search</field>
|
||||
<field name="model">sf.production.plan</field>
|
||||
<field name="arch" type="xml">
|
||||
<gantt class="o_mrp_workorder_gantt" date_stop="plan_end_time" date_start="plan_start_time"
|
||||
string="坯料预制计划" default_group_by="current_operation_name" create="0"
|
||||
<search string="订单计划">
|
||||
<field name="name"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="date_planned_start"/>
|
||||
<field name="date_planned_finished"/>
|
||||
<field name="state"/>
|
||||
<searchpanel class="account_root">
|
||||
<field name="state" icon="fa-filter"/>
|
||||
</searchpanel>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_production_plan_gantt" model="ir.ui.view">
|
||||
<field name="name">sf.production.plan.gantt</field>
|
||||
<field name="model">sf.production.plan</field>
|
||||
<field name="arch" type="xml">
|
||||
<gantt class="o_mrp_workorder_gantt" date_stop="date_planned_finished" date_start="date_planned_start"
|
||||
string="制造订单生产计划" default_group_by="production_line_id" create="0"
|
||||
delete="0" sample="1"
|
||||
display_unavailability="1"
|
||||
color="state"
|
||||
progress_bar="pl_name"
|
||||
form_view_id="sf_pl_plan_form">
|
||||
color="production_line_id"
|
||||
decoration-success="state == 'done'"
|
||||
progress_bar="name"
|
||||
form_view_id="sf_production_plan_form">
|
||||
|
||||
<field name="pl_no"/>
|
||||
<field name="pl_name"/>
|
||||
<field name="quantity"/>
|
||||
<field name="plan_start_time"/>
|
||||
<field name="plan_end_time"/>
|
||||
<field name="name"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="date_planned_start"/>
|
||||
<field name="date_planned_finished"/>
|
||||
<field name="state"/>
|
||||
<templates>
|
||||
<div t-name="gantt-popover" class="container-fluid">
|
||||
@@ -113,20 +136,12 @@
|
||||
<t t-out="userTimezoneStopDate.format('L LTS')"/>
|
||||
</li>
|
||||
<li>
|
||||
<strong>坯料编号:</strong>
|
||||
<t t-out="pl_no"/>
|
||||
</li>
|
||||
<li>
|
||||
<strong>坯料名称:</strong>
|
||||
<t t-out="pl_name"/>
|
||||
<strong>名称:</strong>
|
||||
<t t-out="name"/>
|
||||
</li>
|
||||
<li>
|
||||
<strong>数量:</strong>
|
||||
<t t-out="quantity"/>
|
||||
</li>
|
||||
<li>
|
||||
<strong>材质:</strong>
|
||||
<t t-out="material"/>
|
||||
<t t-out="product_qty"/>
|
||||
</li>
|
||||
<li>
|
||||
<strong>状态:</strong>
|
||||
@@ -142,19 +157,170 @@
|
||||
</record>
|
||||
|
||||
|
||||
<record id="sf_pl_plan_action" model="ir.actions.act_window">
|
||||
<field name="name">坯料预制计划</field>
|
||||
<!-- <record id="sf_pl_plan_action" model="ir.actions.act_window"> -->
|
||||
<!-- <field name="name">制造订单生产计划</field> -->
|
||||
<!-- <field name="type">ir.actions.act_window</field> -->
|
||||
<!-- <field name="res_model">sf.pl.plan</field> -->
|
||||
<!-- <field name="view_mode">tree,form,gantt</field> -->
|
||||
<!-- </record> -->
|
||||
<!-- <record id="sf_production_gantt_view" model="ir.ui.view"> -->
|
||||
<!-- <field name="name">sf.production.plan.gantt</field> -->
|
||||
<!-- <field name="model">mrp.production</field> -->
|
||||
<!-- <field name="arch" type="xml"> -->
|
||||
<!-- <gantt class="o_mrp_workorder_gantt" date_stop="date_planned_finished" date_start="date_planned_start" -->
|
||||
<!-- string="制造订单生产计划" default_group_by="production_line_id" create="0" -->
|
||||
<!-- delete="0" sample="1" plan="0" -->
|
||||
<!-- display_unavailability="1" -->
|
||||
<!-- decoration-success="state == 'done'" -->
|
||||
<!-- decoration-secondary="state == 'cancel'" -->
|
||||
<!-- color="production_line_id" -->
|
||||
<!-- progress_bar="state" -->
|
||||
<!-- form_view_id="mrp.mrp_production_form_view"> -->
|
||||
<!-- <field name="name"/> -->
|
||||
<!-- <field name="product_qty"/> -->
|
||||
<!-- <field name="date_planned_start"/> -->
|
||||
<!-- <field name="date_planned_finished" string="计划结束时间"/> -->
|
||||
<!-- <field name="state"/> -->
|
||||
<!-- <templates> -->
|
||||
<!-- <div t-name="gantt-popover" class="container-fluid"> -->
|
||||
<!-- <div class="row g-0"> -->
|
||||
<!-- <div class="col"> -->
|
||||
<!-- <ul class="ps-1 mb-0 list-unstyled"> -->
|
||||
<!-- <li> -->
|
||||
<!-- <strong>开始时间:</strong> -->
|
||||
<!-- <t t-out="userTimezoneStartDate.format('L LTS')"/> -->
|
||||
<!-- </li> -->
|
||||
<!-- <li> -->
|
||||
<!-- <strong>结束时间:</strong> -->
|
||||
<!-- <t t-out="userTimezoneStopDate.format('L LTS')"/> -->
|
||||
<!-- </li> -->
|
||||
<!-- <li> -->
|
||||
<!-- <strong>数量:</strong> -->
|
||||
<!-- <t t-out="product_qty"/> -->
|
||||
<!-- </li> -->
|
||||
<!-- <li> -->
|
||||
<!-- <strong>状态:</strong> -->
|
||||
<!-- <t t-if="state === 'cancel'">已取消</t> -->
|
||||
<!-- <t t-elif="state === 'done'">已完成</t> -->
|
||||
<!-- <t t-elif="state === '已排程'">已排程</t> -->
|
||||
<!-- <t t-else="">其他状态</t> -->
|
||||
<!-- <t t-out="state"/> -->
|
||||
<!-- </li> -->
|
||||
<!-- </ul> -->
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
<!-- </templates> -->
|
||||
<!-- </gantt> -->
|
||||
<!-- </field> -->
|
||||
<!-- </record> -->
|
||||
|
||||
<record id="sf_machine_schedule_tree" model="ir.ui.view">
|
||||
<field name="name">sf.machine.schedule.tree</field>
|
||||
<field name="model">sf.machine.schedule</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="机台作业计划">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="sf_production_plan_action" model="ir.actions.act_window">
|
||||
<field name="name">制造订单生产计划</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.pl.plan</field>
|
||||
<field name="view_mode">tree,form,gantt</field>
|
||||
<field name="res_model">sf.production.plan</field>
|
||||
<field name="view_mode">gantt,tree,form</field>
|
||||
</record>
|
||||
|
||||
<!-- 这个也是制造订单生产计划,只是把tree视图放在了默认位置 -->
|
||||
<record id="sf_production_plan_action1" model="ir.actions.act_window">
|
||||
<field name="name">制造订单生产计划</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.production.plan</field>
|
||||
<field name="view_mode">tree,gantt,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="sf_pl_plan_menu"
|
||||
name="坯料预制计划"
|
||||
parent="mrp_workorder.mrp_workorder_menu_planning"
|
||||
sequence="10"
|
||||
action="sf_pl_plan_action"
|
||||
id="sf_production_plan_menu"
|
||||
name="计划"
|
||||
sequence="150"
|
||||
action="sf_production_plan_action"
|
||||
/>
|
||||
|
||||
<!-- <record model="ir.ui.menu" id="mrp_custom_menu" inherit_id="mrp.menu_mrp_manufacturing"> -->
|
||||
<!-- <field name="name">Custom Manufacturing Orders</field> -->
|
||||
<!-- <field name="action" ref="mrp.mrp_manufacturing_action"/> -->
|
||||
<!-- --><!-- 扩展现有的动作 --><!-- -->
|
||||
<!-- </record> -->
|
||||
<record model="ir.actions.act_window" id="mrp_custom_action">
|
||||
<!-- 自定义额外的动作 -->
|
||||
<field name="name">制造订单</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">mrp.production</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="sale_custom_action">
|
||||
<!-- 自定义额外的动作 -->
|
||||
<field name="name">报价单</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sale.order</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_machine_work_schedule">
|
||||
<!-- 自定义额外的动作 -->
|
||||
<field name="name">机台作业计划</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.machine.schedule</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
暂无机台作业计划
|
||||
</p>
|
||||
<p>
|
||||
跟进请求的处理,并且和合作者沟通。
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="mrp_custom_menu"
|
||||
name="制造订单"
|
||||
sequence="150"
|
||||
action="mrp_custom_action"
|
||||
parent="sf_production_plan_menu"
|
||||
/>
|
||||
<menuitem
|
||||
id="sale_custom_menu"
|
||||
name="报价单"
|
||||
sequence="50"
|
||||
action="sale_custom_action"
|
||||
parent="sf_production_plan_menu"
|
||||
/>
|
||||
<menuitem
|
||||
id="schedule_custom_menu"
|
||||
name="排程单"
|
||||
sequence="180"
|
||||
action="sf_production_plan_action1"
|
||||
parent="sf_production_plan_menu"
|
||||
/>
|
||||
<!-- <menuitem -->
|
||||
<!-- id="machine_work_schedule" -->
|
||||
<!-- name="机台作业计划" -->
|
||||
<!-- sequence="200" -->
|
||||
<!-- action="action_machine_work_schedule" -->
|
||||
<!-- parent="sf_production_plan_menu" -->
|
||||
<!-- /> -->
|
||||
|
||||
|
||||
<!-- --><!-- 在现有菜单结构后面加入自定义的动作 -->
|
||||
<!-- <menuitem -->
|
||||
<!-- id="mrp_custom_menuitem" -->
|
||||
<!-- name="My Custom Menuitem" -->
|
||||
<!-- sequence="20" -->
|
||||
<!-- action="mrp_custom_action"/> -->
|
||||
<!-- --><!-- 自定义额外的菜单项 --><!-- -->
|
||||
<!-- </field> -->
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sf_manufacturing'],
|
||||
'depends': ['sf_plan'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
# 'security/ir.model.access.csv',
|
||||
|
||||
@@ -21623,7 +21623,7 @@ msgstr "无包裹作业"
|
||||
#. module: mrp
|
||||
#: model:ir.ui.menu,name:mrp.menu_mrp_manufacturing
|
||||
msgid "Operations1"
|
||||
msgstr "计划管理"
|
||||
msgstr "制造订单"
|
||||
|
||||
#. module: mrp_workorder
|
||||
#: model_terms:ir.ui.view,arch_db:mrp_workorder.mrp_workorder_view_form_inherit_workorder
|
||||
|
||||
@@ -135,8 +135,10 @@ class WorkLogSetting(models.Model):
|
||||
# 获取本年第一天和最后一天
|
||||
start_date = datetime.now().replace(month=1, day=1).date()
|
||||
end_date = datetime.now().replace(month=12, day=31).date()
|
||||
print(self.day_off_ids.mapped('name'))
|
||||
# 休息日列表
|
||||
rest_days = self.chinese_weekdays_to_english(self.day_off_ids.mapped('name'))
|
||||
print(rest_days)
|
||||
for single_date in self.daterange(start_date, end_date):
|
||||
is_workday = self.chinese_weekday_to_english(single_date.strftime("%A"))
|
||||
logging.info(f"每天的星期:{is_workday}")
|
||||
@@ -155,13 +157,13 @@ class WorkLogSetting(models.Model):
|
||||
:return:
|
||||
"""
|
||||
weekdays = {
|
||||
'星期一': 'Monday',
|
||||
'星期二': 'Tuesday',
|
||||
'星期三': 'Wednesday',
|
||||
'星期四': 'Thursday',
|
||||
'星期五': 'Friday',
|
||||
'星期六': 'Saturday',
|
||||
'星期日': 'Sunday'
|
||||
'星期一': 'Monday', 'Monday': 'Monday',
|
||||
'星期二': 'Tuesday', 'Tuesday': 'Tuesday',
|
||||
'星期三': 'Wednesday', 'Wednesday': 'Wednesday',
|
||||
'星期四': 'Thursday', 'Thursday': 'Thursday',
|
||||
'星期五': 'Friday', 'Friday': 'Friday',
|
||||
'星期六': 'Saturday', 'Saturday': 'Saturday',
|
||||
'星期日': 'Sunday', 'Sunday': 'Sunday',
|
||||
}
|
||||
english_weekdays = []
|
||||
for chinese_weekday in chinese_weekdays:
|
||||
@@ -177,13 +179,13 @@ class WorkLogSetting(models.Model):
|
||||
:return:
|
||||
"""
|
||||
weekdays = {
|
||||
'星期一': 'Monday',
|
||||
'星期二': 'Tuesday',
|
||||
'星期三': 'Wednesday',
|
||||
'星期四': 'Thursday',
|
||||
'星期五': 'Friday',
|
||||
'星期六': 'Saturday',
|
||||
'星期日': 'Sunday'
|
||||
'星期一': 'Monday', 'Monday': 'Monday',
|
||||
'星期二': 'Tuesday', 'Tuesday': 'Tuesday',
|
||||
'星期三': 'Wednesday', 'Wednesday': 'Wednesday',
|
||||
'星期四': 'Thursday', 'Thursday': 'Thursday',
|
||||
'星期五': 'Friday', 'Friday': 'Friday',
|
||||
'星期六': 'Saturday', 'Saturday': 'Saturday',
|
||||
'星期日': 'Sunday', 'Sunday': 'Sunday',
|
||||
}
|
||||
weekday = weekdays.get(chinese_weekday)
|
||||
if weekday:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<menuitem id="menu_sf_basic_setting"
|
||||
name="基础设置"
|
||||
parent="mrp.menu_mrp_manufacturing"
|
||||
parent="sf_plan.sf_production_plan_menu"
|
||||
sequence="599"
|
||||
/>
|
||||
|
||||
|
||||
@@ -8,16 +8,26 @@
|
||||
<field name="name">Process</field>
|
||||
</record>
|
||||
|
||||
<record id="mrp_workorder.menu_mrp_workorder_workcenter" model="ir.ui.menu">
|
||||
<!-- <field name="name">工单计划</field> -->
|
||||
<field name="sequence" eval="300"/>
|
||||
<field name="parent_id" ref="sf_plan.sf_production_plan_menu"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="mrp_workorder.mrp_workorder_menu_planning" model="ir.ui.menu">
|
||||
<field name="name">工单计划</field>
|
||||
<field name="sequence" eval="300"/>
|
||||
<field name="parent_id" ref="mrp.menu_mrp_manufacturing"/>
|
||||
<!-- <field name="name">工单计划</field> -->
|
||||
<!-- <field name="sequence" eval="300"/> -->
|
||||
<!-- <field name="parent_id" ref="mrp.menu_mrp_manufacturing"/> -->
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="mrp.mrp_planning_menu_root" model="ir.ui.menu">
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
<record id="mrp_workorder.menu_mrp_workorder_production" model="ir.ui.menu">
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import logging
|
||||
from odoo.modules import get_resource_path
|
||||
from odoo import fields, models, api
|
||||
from quatotion import readSql, feature_recognize, auto_quatotion
|
||||
# from quatotion import readSql, feature_recognize, auto_quatotion
|
||||
|
||||
__author__ = 'jinling.yang'
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -24,14 +24,14 @@ class AutoQuatotion(models.Model):
|
||||
def get_process_time_db_path(self):
|
||||
return get_resource_path('sf_sale', 'models', 'process_time.db')
|
||||
|
||||
def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code):
|
||||
'''
|
||||
通过打包好的.so库,
|
||||
以调用autoQuatotion库中Quatotion类,
|
||||
初始化后调用类的analyseShape方法对模型文件进行价格预测
|
||||
'''
|
||||
# 初始化自动报价类(输入特征数据库和加工时间数据库)
|
||||
reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path)
|
||||
# 获取价格、加工时间、尺寸、XYZ、翻面次数
|
||||
feature_info = reader.analyseShape(stp_url, InfoJson={})
|
||||
return feature_info
|
||||
# def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code):
|
||||
# '''
|
||||
# 通过打包好的.so库,
|
||||
# 以调用autoQuatotion库中Quatotion类,
|
||||
# 初始化后调用类的analyseShape方法对模型文件进行价格预测
|
||||
# '''
|
||||
# # 初始化自动报价类(输入特征数据库和加工时间数据库)
|
||||
# reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path)
|
||||
# # 获取价格、加工时间、尺寸、XYZ、翻面次数
|
||||
# feature_info = reader.analyseShape(stp_url, InfoJson={})
|
||||
# return feature_info
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import fields, models, api, SUPERUSER_ID
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
# 刀具物料搜索
|
||||
@@ -9,22 +10,22 @@ class SfToolMaterialSearch(models.Model):
|
||||
|
||||
sequence = fields.Integer('序号')
|
||||
code = fields.Char('编码')
|
||||
name = fields.Char('名称')
|
||||
name = fields.Char('名称', required=True)
|
||||
# 关联刀具类型
|
||||
mrs_cutting_tool_type_id = fields.Many2one(
|
||||
'sf.cutting.tool.type', '刀具类型',
|
||||
domain="[('cutting_tool_material_id.name', '=', cutting_tool_material_name)]")
|
||||
domain="[('cutting_tool_material_id.name', '=', cutting_tool_material_name)]", required=True)
|
||||
# 关联刀具物料名称
|
||||
mrs_cutting_tool_material_name = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料名称',
|
||||
store=True)
|
||||
cutting_tool_type = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料类型', store=True)
|
||||
mrs_machine_brand_id = fields.Many2one('sf.machine.brand', '品牌')
|
||||
mrs_machine_brand_id = fields.Many2one('sf.machine.brand', '品牌', required=True)
|
||||
# 关联刀具型号
|
||||
# mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', '刀具型号')
|
||||
|
||||
# 关联刀具物料模型
|
||||
mrs_cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料',
|
||||
group_expand='_read_group_mrs_cutting_tool_material_ids')
|
||||
group_expand='_read_group_mrs_cutting_tool_material_ids', required=True)
|
||||
cutting_tool_material_name = fields.Char(string='物料名称', invisible=True)
|
||||
|
||||
@api.onchange('mrs_cutting_tool_material_id')
|
||||
@@ -74,19 +75,118 @@ class SfToolMaterialSearch(models.Model):
|
||||
|
||||
# 整体式刀具特有字段
|
||||
integral_code = fields.Char('整体式刀具编码', readonly=True)
|
||||
integral_total_length = fields.Float('整体式刀具总长度(mm)')
|
||||
integral_shank_length = fields.Float('整体式刀具柄部长度(mm)')
|
||||
integral_blade_length = fields.Float('整体式刀具刃部长度(mm)')
|
||||
integral_diameter = fields.Float('整体式刀具直径(mm)')
|
||||
integral_blade_number = fields.Integer('整体式刀具刃数')
|
||||
integral_front_angle = fields.Float('整体式刀具前角(°)')
|
||||
integral_rear_angle = fields.Float('整体式刀具后角(°)')
|
||||
integral_main_included_angle = fields.Float('整体式刀具主偏角(°)')
|
||||
integral_accuracy = fields.Float('整体式刀具精度等级')
|
||||
integral_hardness = fields.Float('整体式刀具加工硬度(HRC)')
|
||||
integral_total_length = fields.Float('整体式刀具总长度(mm)', digits=(6, 1))
|
||||
integral_shank_length = fields.Float('整体式刀具柄部长度(mm)', digits=(6, 1))
|
||||
integral_blade_length = fields.Float('整体式刀具刃部长度(mm)', digits=(6, 1))
|
||||
integral_neck_length = fields.Float('整体式刀具颈部长度(mm)', digits=(6, 1))
|
||||
integral_shank_diameter = fields.Float('整体式刀具柄部直径(mm)', digits=(6, 1))
|
||||
integral_blade_diameter = fields.Float('整体式刀具刃部直径(mm)', digits=(6, 1))
|
||||
integral_neck_diameter = fields.Float('整体式刀具颈部直径(mm)', digits=(6, 1))
|
||||
integral_blade_number = fields.Integer('整体式刀具刃数(个)')
|
||||
integral_blade_tip_diameter = fields.Float('整体式刀具刀尖直径(mm)', digits=(6, 1))
|
||||
integral_blade_tip_taper = fields.Float('整体式刀具刀尖锥度(°)', digits=(6, 1))
|
||||
integral_blade_helix_angle = fields.Float('整体式刀具刃部螺旋角(°)', digits=(6, 1))
|
||||
integral_blade_type = fields.Char('整体式刀具刃部类型')
|
||||
integral_coarse_medium_fine = fields.Selection([('粗', '粗'), ('中', '中'), ('精', '精')], '整体式刀具粗/中/精')
|
||||
# integral_blade_material = fields.Selection([('碳素钢', '碳素钢'), ('硬质合金', '硬质合金')], '整体式刀具刀具材质')
|
||||
integral_hardness = fields.Integer('整体式刀具硬度(HRC)')
|
||||
integral_coating_material = fields.Char('整体式刀具涂层材质')
|
||||
integral_nut = fields.Float('整体式刀具配对螺母(mm)')
|
||||
integral_scope = fields.Char('整体式刀具适用范围')
|
||||
integral_run_out_accuracy_max = fields.Float('整体式刀具端跳精度max', digits=(6,1))
|
||||
integral_run_out_accuracy_min = fields.Float('整体式刀具端跳精度min', digits=(6, 1))
|
||||
|
||||
suitable_machining_method_ids = fields.Many2many('sf.suitable.machining.method',
|
||||
'rel_suitable_machining_method', '适合加工方式')
|
||||
blade_tip_characteristics_ids = fields.Many2many('sf.blade.tip.characteristics',
|
||||
'rel_blade_tip_characteristics', '刀尖特征')
|
||||
handle_type_ids = fields.Many2many('sf.handle.type', 'rel_handle_type', '柄部类型')
|
||||
cutting_direction_ids = fields.Many2many('sf.cutting.direction', 'rel_cutting_direction', '走刀方向')
|
||||
suitable_coolant_ids = fields.Many2many('sf.suitable.coolant', 'rel_suitable_coolant', '适合冷却液')
|
||||
|
||||
cutting_speed_ids = fields.Many2many('sf.cutting.speed', string='切削速度Vc')
|
||||
feed_per_tooth_ids = fields.Many2many('sf.feed.per.tooth', 'rel_feed_per_tooth_ids', '每齿走刀量fz')
|
||||
|
||||
# @api.constrains('suitable_machining_method_ids')
|
||||
# def _check_suitable_machining_method_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("适合加工方式不能为空!")
|
||||
#
|
||||
# @api.constrains('blade_tip_characteristics_ids')
|
||||
# def _check_blade_tip_characteristics_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.blade_tip_characteristics_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刀尖特征不能为空!")
|
||||
# if len(record.blade_tip_characteristics_ids) > 1 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刀尖特征只能单选!")
|
||||
#
|
||||
# @api.constrains('handle_type_ids')
|
||||
# def _check_handle_type_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.handle_type_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部类型不能为空!")
|
||||
# if len(record.handle_type_ids) > 1 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部类型只能单选!")
|
||||
#
|
||||
# @api.constrains('cutting_direction_ids')
|
||||
# def _check_cutting_direction_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.cutting_direction_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("走刀方向不能为空!")
|
||||
#
|
||||
# @api.constrains('suitable_coolant_ids')
|
||||
# def _check_suitable_coolant_ids(self):
|
||||
# for record in self:
|
||||
# if not record.suitable_coolant_ids and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("适合冷却液不能为空!")
|
||||
#
|
||||
# @api.constrains('integral_total_length')
|
||||
# def _check_integral_total_length(self):
|
||||
# if self.integral_total_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("总长度不能为0")
|
||||
#
|
||||
# @api.constrains('integral_shank_length')
|
||||
# def _check_integral_shank_length(self):
|
||||
# if self.integral_shank_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部长度不能为0")
|
||||
#
|
||||
# @api.constrains('integral_blade_length')
|
||||
# def _check_integral_blade_length(self):
|
||||
# if self.integral_blade_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刃部长度不能为0")
|
||||
#
|
||||
# @api.constrains('integral_blade_number')
|
||||
# def _check_integral_blade_number(self):
|
||||
# if self.integral_blade_number <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刃数不能为0")
|
||||
#
|
||||
# @api.constrains('integral_shank_diameter')
|
||||
# def _check_integral_shank_diameter(self):
|
||||
# if self.integral_shank_diameter <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部直径不能为0")
|
||||
#
|
||||
# @api.constrains('integral_blade_diameter')
|
||||
# def _check_integral_blade_diameter(self):
|
||||
# if self.integral_blade_diameter <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刃部直径不能为0")
|
||||
#
|
||||
# @api.constrains('integral_run_out_accuracy_min')
|
||||
# def _check_integral_blade_diameter(self):
|
||||
# if self.integral_run_out_accuracy_min <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("端跳精度最小(min)不能为0")
|
||||
#
|
||||
# @api.constrains('integral_run_out_accuracy_max')
|
||||
# def _check_integral_run_out_accuracy_max(self):
|
||||
# if self.integral_run_out_accuracy_max <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("端跳精度最大(max)不能为0")
|
||||
|
||||
# integral_front_angle = fields.Float('整体式刀具前角(°)')
|
||||
# integral_rear_angle = fields.Float('整体式刀具后角(°)')
|
||||
# integral_main_included_angle = fields.Float('整体式刀具主偏角(°)')
|
||||
# integral_accuracy = fields.Float('整体式刀具精度等级')
|
||||
# integral_hardness = fields.Float('整体式刀具加工硬度(HRC)')
|
||||
# integral_coating_material = fields.Char('整体式刀具涂层材质')
|
||||
# integral_nut = fields.Float('整体式刀具配对螺母(mm)')
|
||||
# integral_scope = fields.Char('整体式刀具适用范围')
|
||||
|
||||
# 刀杆特有字段
|
||||
bar_code = fields.Char('刀杆编码', readonly=True)
|
||||
@@ -193,4 +293,3 @@ class SfToolMaterialSearch(models.Model):
|
||||
warehouse_area = fields.Char('库区')
|
||||
warehouse_location = fields.Char('库位')
|
||||
three_d_model = fields.Many2one('ir.attachment', '3D模型')
|
||||
|
||||
|
||||
@@ -1080,7 +1080,7 @@
|
||||
<field name="name">功能刀具组装</field>
|
||||
<field name="model">sf.functional.tool.assembly</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<tree create="0">
|
||||
<field name="functional_tool_code"/>
|
||||
<field name="name"/>
|
||||
<field name="functional_tool_type_id"/>
|
||||
@@ -1133,7 +1133,7 @@
|
||||
<field name="name">功能刀具组装</field>
|
||||
<field name="model">sf.functional.tool.assembly</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<form create="0">
|
||||
<header>
|
||||
<button string="组装"
|
||||
name="%(sf_tool_management.sf_functional_tool_assembly_order_act)d"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<field name="model">sf.tool.material.search</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="刀具物料查询">
|
||||
<field name="sequence"/>
|
||||
<field name="sequence" invisible="True"/>
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="mrs_cutting_tool_type_id"/>
|
||||
@@ -33,19 +33,19 @@
|
||||
<field name="mrs_cutting_tool_model_blade_cutter_bar_ids" optional="hide"/>
|
||||
|
||||
<!-- <field name="integral_code" readonly="1"/> -->
|
||||
<field name="integral_total_length" optional="hide"/>
|
||||
<field name="integral_shank_length" optional="hide"/>
|
||||
<field name="integral_blade_length" optional="hide"/>
|
||||
<field name="integral_diameter" optional="hide"/>
|
||||
<field name="integral_blade_number" optional="hide"/>
|
||||
<field name="integral_front_angle" optional="hide"/>
|
||||
<field name="integral_rear_angle" optional="hide"/>
|
||||
<field name="integral_main_included_angle" optional="hide"/>
|
||||
<field name="integral_accuracy" optional="hide"/>
|
||||
<field name="integral_hardness" optional="hide"/>
|
||||
<field name="integral_coating_material" optional="hide"/>
|
||||
<field name="integral_nut" optional="hide"/>
|
||||
<field name="integral_scope" optional="hide"/>
|
||||
<!-- <field name="integral_total_length" optional="hide"/>-->
|
||||
<!-- <field name="integral_shank_length" optional="hide"/>-->
|
||||
<!-- <field name="integral_blade_length" optional="hide"/>-->
|
||||
<!-- <field name="integral_diameter" optional="hide"/>-->
|
||||
<!-- <field name="integral_blade_number" optional="hide"/>-->
|
||||
<!-- <field name="integral_front_angle" optional="hide"/>-->
|
||||
<!-- <field name="integral_rear_angle" optional="hide"/>-->
|
||||
<!-- <field name="integral_main_included_angle" optional="hide"/>-->
|
||||
<!-- <field name="integral_accuracy" optional="hide"/>-->
|
||||
<!-- <field name="integral_hardness" optional="hide"/>-->
|
||||
<!-- <field name="integral_coating_material" optional="hide"/>-->
|
||||
<!-- <field name="integral_nut" optional="hide"/>-->
|
||||
<!-- <field name="integral_scope" optional="hide"/>-->
|
||||
|
||||
<!-- <field name="bar_code" readonly="1"/> -->
|
||||
<field name="bar_c_diameter" optional="hide"/>
|
||||
@@ -134,13 +134,13 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="mrs_cutting_tool_material_name" invisible="1"/>
|
||||
<field name="sequence"/>
|
||||
<field name="sequence" invisible="True"/>
|
||||
<field name="code"/>
|
||||
<field name="mrs_cutting_tool_material_id"/>
|
||||
<field name="mrs_cutting_tool_type_id"/>
|
||||
<field name="mrs_machine_brand_id"/>
|
||||
<!-- <field name="mrs_materials_model_id" attrs="{'invisible':[('cutting_tool_type','=','整体式刀具')]}"/>-->
|
||||
<!-- <field name="mrs_cutting_tool_model_id"/> -->
|
||||
<field name="mrs_materials_model_id"/>
|
||||
<field name="mrs_cutting_tool_material_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="image" widget="image"/>
|
||||
@@ -188,27 +188,69 @@
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<!-- -->
|
||||
<page string="整体式刀具信息" attrs="{'invisible': [('cutting_tool_type','!=','整体式刀具')]}">
|
||||
<group>
|
||||
<group>
|
||||
<field name="integral_code" invisible="True"/>
|
||||
<field name="integral_total_length" string="总长度(mm)"/>
|
||||
<field name="integral_shank_length" string="柄部长度(mm)"/>
|
||||
<field name="mrs_materials_model_id" string="刀具材质" placeholder="请选择"
|
||||
attrs="{'required': [('cutting_tool_type','=','整体式刀具')]}"/>
|
||||
<field name="integral_hardness" string="刀具硬度(HRC)"/>
|
||||
<field name="integral_blade_length" string="刃部长度(mm)"/>
|
||||
<field name="integral_diameter" string="直径(mm)"/>
|
||||
<field name="integral_blade_number" string="刃数"/>
|
||||
<field name="integral_accuracy" string="精度等级"/>
|
||||
<field name="integral_blade_diameter" string="刃部直径(mm)" class="diameter"/>
|
||||
<field name="integral_blade_type" string="刃部类型"/>
|
||||
<field name="integral_blade_helix_angle" string="刃部螺旋角(°)"/>
|
||||
<field name="integral_blade_number" string="刃数(个)"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="integral_front_angle" string="前角(°)"/>
|
||||
<field name="integral_rear_angle" string="后角(°)"/>
|
||||
<field name="integral_main_included_angle" string="主偏角(°)"/>
|
||||
<field name="integral_nut" string="配对螺母(mm)"/>
|
||||
<field name="integral_hardness" string="加工硬度(HRC)"/>
|
||||
<field name="integral_shank_length" string="柄部长度(mm)"/>
|
||||
<field name="integral_shank_diameter" string="柄部直径(mm)" class="diameter"/>
|
||||
<field name="integral_neck_length" string="颈部长度(mm)"/>
|
||||
<field name="integral_neck_diameter" string="颈部直径(mm)" class="diameter"/>
|
||||
<field name="integral_blade_tip_diameter" string="刀尖直径(mm)" class="diameter"/>
|
||||
<field name="integral_blade_tip_taper" string="刀尖锥度(°)"/>
|
||||
<label for="integral_run_out_accuracy_min" string="端跳精度:"/>
|
||||
<div class="test_model">
|
||||
<label for="integral_run_out_accuracy_min" string="最小(min)"/>
|
||||
<field name="integral_run_out_accuracy_min" class="o_address_zip" required="1"
|
||||
options="{'format': false}" attrs="{'required': [('cutting_tool_type','=','整体式刀具')]}"/>
|
||||
<span>(mm)&nbsp;</span>
|
||||
<label for="integral_run_out_accuracy_max" string="最大(max)"/>
|
||||
<field name="integral_run_out_accuracy_max" class="o_address_zip" required="1"
|
||||
options="{'format': false}" attrs="{'required': [('cutting_tool_type','=','整体式刀具')]}"/>
|
||||
<span>(mm)&nbsp;</span>
|
||||
</div>
|
||||
<field name="integral_coarse_medium_fine" string="粗/中/精" placeholder="请选择"
|
||||
attrs="{'required': [('cutting_tool_type','=','整体式刀具')]}"/>
|
||||
<field name="integral_coating_material" string="涂层材质"/>
|
||||
<field name="integral_scope" string="适用范围"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="适合加工方式">
|
||||
<field name="suitable_machining_method_ids" string="" widget="custom_many2many_checkboxes"/>
|
||||
</group>
|
||||
<group>
|
||||
<group string="刀尖特征">
|
||||
<field name="blade_tip_characteristics_ids" string="" widget="custom_many2many_checkboxes"/>
|
||||
</group>
|
||||
<group string="柄部类型">
|
||||
<field name="handle_type_ids" string="" widget="custom_many2many_checkboxes"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group string="走刀方向">
|
||||
<field name="cutting_direction_ids" string="" widget="custom_many2many_checkboxes"/>
|
||||
</group>
|
||||
<group string="适合冷却液">
|
||||
<field name="suitable_coolant_ids" string="" widget="custom_many2many_checkboxes"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="切削速度Vc" attrs="{'invisible': [('cutting_tool_type','!=','整体式刀具')]}">
|
||||
<field name="cutting_speed_ids" string=""/>
|
||||
</page>
|
||||
<page string="每齿走刀量fz" attrs="{'invisible': [('cutting_tool_type','!=','整体式刀具')]}">
|
||||
<field name="feed_per_tooth_ids" string=""/>
|
||||
</page>
|
||||
<page string="刀杆信息" attrs="{'invisible': [('cutting_tool_type','!=','刀杆')]}">
|
||||
<group>
|
||||
|
||||
@@ -637,8 +637,10 @@ export default AbstractRenderer.extend(WidgetAdapterMixin, {
|
||||
case 'day':
|
||||
return focusDate.format('dddd, MMMM DD, YYYY');
|
||||
case 'week':
|
||||
const dateStart = focusDate.clone().startOf('week').format('DD MMMM YYYY');
|
||||
const dateEnd = focusDate.clone().endOf('week').format('DD MMMM YYYY');
|
||||
// const dateStart = focusDate.clone().startOf('week').format('DD MMMM YYYY');
|
||||
const dateStart = focusDate.clone().startOf('week').format('YYYY MMMM DD ');
|
||||
// const dateEnd = focusDate.clone().endOf('week').format('DD MMMM YYYY');
|
||||
const dateEnd = focusDate.clone().endOf('week').format('YYYY MMMM DD ');
|
||||
return _.str.sprintf('%s - %s', dateStart, dateEnd);
|
||||
case 'month':
|
||||
return focusDate.format('MMMM YYYY');
|
||||
|
||||
@@ -112,7 +112,7 @@ const GanttView = AbstractView.extend({
|
||||
allowedScales = Object.keys(this.SCALES);
|
||||
}
|
||||
|
||||
const scale = params.context.default_scale || arch.attrs.default_scale || 'month';
|
||||
const scale = params.context.default_scale || arch.attrs.default_scale || 'week';
|
||||
const initialDate = moment(params.context.initialDate || params.initialDate || arch.attrs.initial_date || new Date());
|
||||
const offset = arch.attrs.offset;
|
||||
if (offset && scale) {
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-0 o_gantt_header_scale">
|
||||
<t t-set="formats" t-value="{'week': 'dddd, Do', 'month': 'DD', 'year': isMobile ? 'MMM' : 'MMMM'}"/>
|
||||
<t t-set="formats" t-value="{'week': 'Do(dddd)', 'month': 'DD', 'year': isMobile ? 'MMM' : 'MMMM'}"/>
|
||||
|
||||
<t t-foreach="widget.viewInfo.slots" t-as="slot">
|
||||
<t t-set="isToday" t-value="slot.isSame(new Date(), 'day') && widget.state.scale !== 'day'"/>
|
||||
|
||||
Reference in New Issue
Block a user