产品新增刀具规格向导
This commit is contained in:
@@ -6,6 +6,7 @@ class ToolMaterialsBasicParameters(models.Model):
|
||||
_description = '刀具物料基本参数'
|
||||
|
||||
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具标准库')
|
||||
specification_id = fields.Many2one('sf.cutting_tool.specification.wizard', string='刀具规格')
|
||||
cutting_tool_type = fields.Char(related='standard_library_id.cutting_tool_type', string='刀具物料类型',
|
||||
store=True)
|
||||
# cutting_tool_type_1 = fields.Char(related='cutting_tool_type', string='类型', store=True)
|
||||
@@ -288,7 +289,8 @@ class CuttingSpeed(models.Model):
|
||||
_name = 'sf.cutting.speed'
|
||||
_description = '切削速度Vc'
|
||||
|
||||
# product_template_id = fields.Many2one('product.template', string='产品')
|
||||
product_template_id = fields.Many2one('product.template')
|
||||
specification_id = fields.Many2one('sf.cutting_tool.specification.wizard', string='刀具规格')
|
||||
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='标准库')
|
||||
execution_standard_id = fields.Many2one('sf.international.standards', string='执行标准', store=True)
|
||||
material_code = fields.Char('材料代号')
|
||||
@@ -333,8 +335,9 @@ class FeedPerTooth(models.Model):
|
||||
_description = '每齿走刀量fz'
|
||||
_order = 'machining_method desc, blade_diameter, materials_type_id'
|
||||
|
||||
# product_template_id = fields.Many2one('product.template', string='产品')
|
||||
product_template_id = fields.Many2one('product.template')
|
||||
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='标准库')
|
||||
specification_id = fields.Many2one('sf.cutting_tool.specification.wizard', string='刀具规格')
|
||||
cutting_speed = fields.Char('径向切宽 ae(mm)')
|
||||
machining_method = fields.Selection([('直铣', '直铣'), ('坡铣', '坡铣')], string='加工方式')
|
||||
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
|
||||
|
||||
@@ -162,3 +162,21 @@ td.o_required_modifier {
|
||||
justify-content: flex-start !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
|
||||
//用于label外的div
|
||||
.type_label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.button_width button {
|
||||
width:11rem;
|
||||
margin-top: -9px;
|
||||
height: 2.5rem;
|
||||
line-height: 1.5rem;
|
||||
}
|
||||
|
||||
.button_width{
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
# from . import models
|
||||
from . import wizard
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
'data': [
|
||||
'data/product_data.xml',
|
||||
'data/uom_data.xml',
|
||||
# 'views/product_template_view.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'wizard/cutting_tool_specification_wizard.xml',
|
||||
'views/product_template_view.xml',
|
||||
'views/product_workorder.xml'
|
||||
],
|
||||
'demo': [
|
||||
|
||||
4
sf_dlm/security/group_security.xml
Normal file
4
sf_dlm/security/group_security.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<odoo>
|
||||
<data>
|
||||
</data>
|
||||
</odoo>
|
||||
12
sf_dlm/security/ir.model.access.csv
Normal file
12
sf_dlm/security/ir.model.access.csv
Normal file
@@ -0,0 +1,12 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_sf_cutting_tool_specification_wizard,sf_cutting_tool_specification_wizard,model_sf_cutting_tool_specification_wizard,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -51,6 +51,18 @@
|
||||
attrs="{'invisible': ['|',('categ_type', '!=', '表面工艺'),('categ_type', '=', False)]}"/>
|
||||
<field name="cutting_tool_material_id" attrs="{'invisible': [('categ_type', '!=', '刀具')]}"
|
||||
placeholder="请选择"/>
|
||||
<label for="cutting_tool_model_id" string="型号" class="type_label"
|
||||
attrs="{'invisible': [('categ_type', '!=', '刀具')]}"/>
|
||||
<div attrs="{'invisible': [('categ_type', '!=', '刀具')]}" class="button_width">
|
||||
<field name="cutting_tool_model_id" placeholder="请选择"
|
||||
domain="[('cutting_tool_material_id','=',cutting_tool_material_id)]"/>
|
||||
<button string="选择刀具规格" type="action" name="%(action_cutting_tool_specification_wizard)d"
|
||||
class="oe_highlight"
|
||||
context="{'default_cutting_tool_material_id': cutting_tool_material_id,
|
||||
'default_cutting_tool_library_id': cutting_tool_model_id,
|
||||
'default_cutting_tool_type': cutting_tool_type}"
|
||||
/>
|
||||
</div>
|
||||
<field name="fixture_material_id" attrs="{'invisible': [('categ_type', '!=', '夹具')]}"
|
||||
placeholder="请选择"/>
|
||||
<field name="fixture_model_id" string="型号" placeholder="请选择"
|
||||
@@ -309,19 +321,19 @@
|
||||
<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', ('刀片'))]}"/>
|
||||
<field name="cutting_tool_cutter_pad_ids" widget="many2many_tags"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/>
|
||||
<field name="cutting_tool_blade_ids" widget="many2many_tags"
|
||||
options="{'no_create': True}"
|
||||
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', ('刀片'))]}"/>-->
|
||||
<!-- <field name="cutting_tool_cutter_pad_ids" widget="many2many_tags"-->
|
||||
<!-- options="{'no_create': True}"-->
|
||||
<!-- attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}"/>-->
|
||||
<!-- <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_chuck_ids" widget="many2many_tags"-->
|
||||
<!-- options="{'no_create': True}"-->
|
||||
<!-- attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀杆','刀盘','刀柄'))]}"/>-->
|
||||
<field name="apply_lock_nut_model"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
|
||||
<field name="apply_lock_wrench_model"
|
||||
@@ -359,7 +371,7 @@
|
||||
<!-- <field name="order"/>-->
|
||||
<field name="execution_standard_id"/>
|
||||
<field name="material_code"/>
|
||||
<field name="material_name"/>
|
||||
<field name="material_id"/>
|
||||
<field name="material_grade"/>
|
||||
<field name="tensile_strength"/>
|
||||
<field name="hardness"/>
|
||||
@@ -385,7 +397,6 @@
|
||||
attrs="{'readonly': [('cutting_speed','!=',False)]}"/>
|
||||
<field name="blade_diameter"/>
|
||||
<field name="feed_per_tooth"/>
|
||||
<field name="unit"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
||||
3
sf_dlm/wizard/__init__.py
Normal file
3
sf_dlm/wizard/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import cutting_tool_specification_wizard
|
||||
44
sf_dlm/wizard/cutting_tool_specification_wizard.py
Normal file
44
sf_dlm/wizard/cutting_tool_specification_wizard.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Cutting_toolSpecificationWizard(models.TransientModel):
|
||||
_name = "sf.cutting_tool.specification.wizard"
|
||||
_description = u'刀具规格'
|
||||
|
||||
cutting_tool_library_id = fields.Many2one('sf.cutting_tool.standard.library', '刀具标准库')
|
||||
cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料')
|
||||
cutting_tool_type = fields.Char(related=cutting_tool_material_id.name)
|
||||
cutting_tool_type_id = fields.Many2one('sf.cutting.tool.type', '刀具类型')
|
||||
brand_id = fields.Many2one('sf.machine.brand', '品牌')
|
||||
integral_tool_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'specification_id', string='整体式刀具基本参数')
|
||||
blade_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'specification_id', string='刀片基本参数')
|
||||
cutter_bar_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'specification_id', string='刀杆基本参数')
|
||||
cutter_head_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'specification_id', string='刀盘基本参数')
|
||||
knife_handle_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'specification_id', string='刀柄基本参数')
|
||||
chuck_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'specification_id', string='夹头基本参数')
|
||||
cutting_speed_ids = fields.One2many('sf.cutting.speed', 'specification_id', string='切削速度Vc')
|
||||
feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'specification_id', '每齿走刀量fz',
|
||||
domain=[('cutting_speed', '!=', False)])
|
||||
feed_per_tooth_ids_2 = fields.One2many('sf.feed.per.tooth', 'specification_id', '每齿走刀量fz',
|
||||
domain=[('machining_method', '!=', False)])
|
||||
feed_per_tooth_ids_3 = fields.One2many('sf.feed.per.tooth', 'specification_id', '每齿走刀量fz',
|
||||
domain=[('cutting_speed', '!=', False)])
|
||||
feed_per_tooth_ids_4 = fields.One2many('sf.feed.per.tooth', 'specification_id', '每齿走刀量fz',
|
||||
domain=[('machining_method', '!=', False)])
|
||||
|
||||
@api.depends('cutting_tool_library_id')
|
||||
def set_specification(self):
|
||||
for vals in self.cutting_tool_library_id.integral_tool_basic_parameters_ids:
|
||||
vals.write({'specification_id': self.id})
|
||||
266
sf_dlm/wizard/cutting_tool_specification_wizard.xml
Normal file
266
sf_dlm/wizard/cutting_tool_specification_wizard.xml
Normal file
@@ -0,0 +1,266 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="cutting_tool_specification_wizard_form_view">
|
||||
<field name="name">sf.cutting_tool.specification.wizard.form.view</field>
|
||||
<field name="model">sf.cutting_tool.specification.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="刀具规格">
|
||||
<group>
|
||||
<field name="cutting_tool_material_id" readonly="1"/>
|
||||
<field name="cutting_tool_type_id" readonly="1" string="刀具类型"/>
|
||||
<field name="cutting_tool_library_id" readonly="1" string="型号"/>
|
||||
<field name="brand_id" readonly="1"/>
|
||||
<field name="cutting_tool_type" invisible="1"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="基本参数">
|
||||
<field name="integral_tool_basic_parameters_ids"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}">
|
||||
<tree class="center">
|
||||
<field name="cutting_tool_type" invisible="1"/>
|
||||
<field name="specification_id" invisible="1"/>
|
||||
<field name="code"/>
|
||||
<field name="total_length"/>
|
||||
<field name="blade_diameter" class="diameter"/>
|
||||
<field name="blade_length"/>
|
||||
<field name="blade_number" placeholder="请选择"/>
|
||||
<field name="neck_length"/>
|
||||
<field name="neck_diameter" class="diameter"/>
|
||||
<field name="handle_diameter" class="diameter"/>
|
||||
<field name="handle_length"/>
|
||||
<field name="blade_tip_working_size" class="du"/>
|
||||
<field name="blade_tip_diameter" class="diameter"/>
|
||||
<field name="blade_tip_taper" class="du"/>
|
||||
<field name="blade_helix_angle" class="du"/>
|
||||
<field name="pitch"/>
|
||||
<field name="blade_width"/>
|
||||
<field name="blade_depth"/>
|
||||
<field name="cutting_depth"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
<field name="blade_basic_parameters_ids"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀片')]}">
|
||||
<tree editable="bottom" class="center">
|
||||
<field name="cutting_tool_type" invisible="1"/>
|
||||
<field name="specification_id" invisible="1"/>
|
||||
<field name="code"/>
|
||||
<field name="length"/>
|
||||
<field name="thickness"/>
|
||||
<field name="width"/>
|
||||
<field name="cutting_blade_length"/>
|
||||
<field name="relief_angle" class="du"/>
|
||||
<field name="blade_tip_circular_arc_radius"/>
|
||||
<field name="inscribed_circle_diameter" class="diameter"/>
|
||||
<field name="install_aperture_diameter" class="diameter"/>
|
||||
<field name="pitch"/>
|
||||
<field name="chip_breaker_groove" placeholder="请选择"/>
|
||||
<field name="blade_teeth_model" placeholder="请选择"/>
|
||||
<field name="cutting_depth" string="最大切削深度(mm)"/>
|
||||
<field name="blade_blade_number" string="刃数(个)"/>
|
||||
<field name="blade_width" string="刃宽(mm)"/>
|
||||
<field name="main_included_angle"/>
|
||||
<field name="top_angle"/>
|
||||
<field name="blade_tip_dip_angle"/>
|
||||
<field name="side_cutting_edge_angle"/>
|
||||
<field name="thread_model" placeholder="请选择"/>
|
||||
<field name="thread_num"/>
|
||||
<field name="blade_tip_height_tolerance"/>
|
||||
<field name="inscribed_circle_tolerance"/>
|
||||
<field name="thickness_tolerance"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="cutter_bar_basic_parameters_ids"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀杆')]}">
|
||||
<tree editable="bottom" class="center">
|
||||
<field name="cutting_tool_type" invisible="1"/>
|
||||
<field name="specification_id" invisible="1"/>
|
||||
<field name="code"/>
|
||||
<field name="height"/>
|
||||
<field name="width"/>
|
||||
<field name="total_length"/>
|
||||
<field name="blade_height"/>
|
||||
<field name="blade_width"/>
|
||||
<field name="blade_length"/>
|
||||
<field name="blade_diameter" class="diameter"/>
|
||||
<field name="cutter_arbor_diameter" class="diameter"/>
|
||||
<field name="main_included_angle" class="du"/>
|
||||
<field name="relief_angle" class="du"/>
|
||||
<field name="cutting_depth" string="最大切削深度(mm)"/>
|
||||
<field name="min_machining_aperture" class="diameter"/>
|
||||
<field name="install_blade_tip_num"/>
|
||||
<field name="cutting_blade_model"/>
|
||||
<field name="cooling_hole" placeholder="请选择"/>
|
||||
<field name="locating_slot_code"/>
|
||||
<field name="installing_structure"/>
|
||||
<field name="blade_ids" widget="many2many_tags" placeholder="请选择"/>
|
||||
<field name="tool_shim"/>
|
||||
<field name="cotter_pin"/>
|
||||
<field name="pressing_plate"/>
|
||||
<field name="screw"/>
|
||||
<field name="spanner"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
<field name="cutter_head_basic_parameters_ids"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀盘')]}">
|
||||
<tree editable="bottom" class="center" delete="1">
|
||||
<field name="cutting_tool_type" invisible="1"/>
|
||||
<field name="specification_id" invisible="1"/>
|
||||
<field name="code"/>
|
||||
<field name="install_blade_tip_num"/>
|
||||
<field name="blade_diameter" class="diameter"/>
|
||||
<field name="cutter_head_diameter" class="diameter"/>
|
||||
<field name="interface_diameter" class="diameter"/>
|
||||
<field name="total_length"/>
|
||||
<field name="blade_length"/>
|
||||
<field name="cutting_depth" string="最大切削深度(mm)"/>
|
||||
<field name="main_included_angle" class="du"/>
|
||||
<field name="installing_structure"/>
|
||||
<field name="blade_ids" widget="many2many_tags" placeholder="请选择"/>
|
||||
<field name="screw"/>
|
||||
<field name="spanner"/>
|
||||
<field name="cutting_blade_model"/>
|
||||
<field name="cooling_hole" placeholder="请选择"/>
|
||||
<field name="locating_slot_code"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
<field name="knife_handle_basic_parameters_ids"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}">
|
||||
<tree editable="bottom" class="center">
|
||||
<field name="cutting_tool_type" invisible="1"/>
|
||||
<field name="specification_id" invisible="1"/>
|
||||
<field name="code"/>
|
||||
<field name="total_length"/>
|
||||
<field name="flange_shank_length"/>
|
||||
<field name="handle_external_diameter" class="diameter"/>
|
||||
<field name="handle_inside_diameter" class="diameter"/>
|
||||
<field name="min_clamping_diameter" class="diameter"/>
|
||||
<field name="max_clamping_diameter" class="diameter"/>
|
||||
<field name="clamping_mode"/>
|
||||
<field name="max_load_capacity"/>
|
||||
<field name="taper" class="du"/>
|
||||
<field name="tool_changing_time"/>
|
||||
<field name="standard_rotate_speed"/>
|
||||
<field name="max_rotate_speed"/>
|
||||
<field name="diameter_slip_accuracy"/>
|
||||
<field name="cooling_model"/>
|
||||
<field name="is_rough_machining" placeholder="请选择"/>
|
||||
<field name="is_finish_machining" placeholder="请选择"/>
|
||||
<field name="is_quick_cutting" placeholder="请选择"/>
|
||||
<field name="is_drill_hole" placeholder="请选择"/>
|
||||
<field name="is_safe_lock" placeholder="请选择"/>
|
||||
<field name="screw"/>
|
||||
<field name="spanner"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="chuck_basic_parameters_ids"
|
||||
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}">
|
||||
<tree editable="bottom" class="center">
|
||||
<field name="cutting_tool_type" invisible="1"/>
|
||||
<field name="specification_id" invisible="1"/>
|
||||
<field name="code"/>
|
||||
<field name="er_size_model"/>
|
||||
<field name="min_clamping_diameter" class="diameter" required="1"/>
|
||||
<field name="max_clamping_diameter" class="diameter"/>
|
||||
<field name="outer_diameter" class="diameter"/>
|
||||
<field name="inner_diameter" class="diameter"/>
|
||||
<field name="total_length"/>
|
||||
<field name="taper" class="du"/>
|
||||
<field name="run_out_accuracy"/>
|
||||
<field name="top_diameter" class="diameter"/>
|
||||
<field name="weight"/>
|
||||
<field name="clamping_mode"/>
|
||||
<field name="clamping_length"/>
|
||||
<field name="clamping_tolerance"/>
|
||||
<field name="max_load_capacity"/>
|
||||
<field name="handle_ids" widget="many2many_tags" placeholder="请选择"/>
|
||||
<field name="cooling_jacket"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="切削速度Vc"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))]}">
|
||||
<field name="cutting_speed_ids">
|
||||
<tree editable="bottom" class="center">
|
||||
<field name="execution_standard_id" placeholder="请选择" required="1"/>
|
||||
<field name="specification_id" invisible="1"/>
|
||||
<field name="material_code" readonly="1"/>
|
||||
<field name="material_id" placeholder="请选择"
|
||||
attrs="{'readonly': [('execution_standard_id', '=', False)], 'required': [('execution_standard_id', '!=', False)]}"/>
|
||||
<field name="material_grade" readonly="1"/>
|
||||
<field name="tensile_strength" readonly="1"/>
|
||||
<field name="hardness" readonly="1"/>
|
||||
<field name="slope_milling_angle" widget="du"/>
|
||||
<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" placeholder="请选择" required="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="每齿走刀量fz"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))]}">
|
||||
<field name="feed_per_tooth_ids"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具'))]}">
|
||||
<tree editable="bottom" class="center">
|
||||
<field name="specification_id" invisible="1"/>
|
||||
<field name="cutting_speed"/>
|
||||
<field name="blade_diameter"/>
|
||||
<field name="feed_per_tooth" required="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="feed_per_tooth_ids_2"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具'))]}">
|
||||
<tree editable="bottom" class="center" create="0" delete="0">
|
||||
<field name="specification_id" invisible="1"/>
|
||||
<field name="machining_method"/>
|
||||
<field name="materials_type_id"/>
|
||||
<field name="blade_diameter"/>
|
||||
<field name="feed_per_tooth" required="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="feed_per_tooth_ids_3"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}">
|
||||
<tree editable="bottom" class="center">
|
||||
<field name="specification_id" invisible="1"/>
|
||||
<field name="cutting_speed"/>
|
||||
<field name="feed_per_tooth" required="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="feed_per_tooth_ids_4"
|
||||
attrs="{'invisible': [('cutting_tool_type', 'not in', ('刀片'))]}">
|
||||
<tree editable="bottom" class="center">
|
||||
<field name="specification_id" invisible="1"/>
|
||||
<field name="machining_method"/>
|
||||
<field name="materials_type_id"/>
|
||||
<field name="feed_per_tooth" required="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
<footer>
|
||||
<!-- <button string="确认" name="submit" type="object" class="oe_highlight"/>-->
|
||||
<!-- <button string="取消" class="btn btn-secondary" special="cancel"/>-->
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_cutting_tool_specification_wizard" model="ir.actions.act_window">
|
||||
<field name="name">刀具规格</field>
|
||||
<field name="res_model">sf.cutting_tool.specification.wizard</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="cutting_tool_specification_wizard_form_view"/>
|
||||
<field name="target">new</field>
|
||||
<!-- <field name="context">{-->
|
||||
<!-- 'default_cutting_tool_model_id' : cutting_tool_model_id,-->
|
||||
<!-- }</field>-->
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -1 +1,2 @@
|
||||
from . import models
|
||||
|
||||
|
||||
@@ -63,10 +63,8 @@ class ResProductMo(models.Model):
|
||||
cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', string='刀具物料')
|
||||
cutting_tool_type = fields.Char(string="刀具物料类型", related='cutting_tool_material_id.name', store=True)
|
||||
|
||||
cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', string='型号',
|
||||
)
|
||||
cutting_tool_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='型号')
|
||||
|
||||
cutting_tool_model = fields.Char('型号')
|
||||
cutting_tool_type_id = fields.Many2one('sf.cutting.tool.type', string='类型',
|
||||
domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]")
|
||||
|
||||
@@ -178,8 +176,8 @@ class ResProductMo(models.Model):
|
||||
# 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')
|
||||
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):
|
||||
@@ -280,6 +278,21 @@ class ResProductMo(models.Model):
|
||||
# domain="[('cutting_tool_type', '=', '刀柄')]",
|
||||
# string='适用刀柄型号'
|
||||
# )
|
||||
|
||||
# @api.onchange('cutting_tool_model_id')
|
||||
# def onchange_method(self):
|
||||
# if self.cutting_tool_model_id:
|
||||
# return {
|
||||
# 'name': 'Import your first bill',
|
||||
# 'view_mode': 'form',
|
||||
# 'target': 'new',
|
||||
# 'view_type': 'form',
|
||||
# 'res_model': 'sf.cutting_tool.standard.library',
|
||||
# 'context': {'default_res_id': self.cutting_tool_model_id.id},
|
||||
# 'views': [[False, 'form']],
|
||||
# 'res_id': self.cutting_tool_model_id.id,
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# }
|
||||
# 夹具参数
|
||||
fixture_material_id = fields.Many2one('sf.fixture.material', string="夹具物料")
|
||||
fixture_model_id = fields.Many2one('sf.fixture.model', string="夹具型号")
|
||||
@@ -408,41 +421,11 @@ class ResProductMo(models.Model):
|
||||
self.detailed_type = 'product'
|
||||
self.sale_ok = False
|
||||
|
||||
@api.onchange('cutting_tool_material_id')
|
||||
def _onchange_cutting_tool_material_id(self):
|
||||
if self.cutting_tool_material_id:
|
||||
try:
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
|
||||
url = config['sf_url'] + '/api/cutting_model/list'
|
||||
res = {'token': config['token'], 'cutting_tool_material_code': self.cutting_tool_material_id.code}
|
||||
result = requests.post(url, json={}, data=res, headers=headers)
|
||||
result = result.json()
|
||||
if result['status'] == 1:
|
||||
data = result['data']
|
||||
model_ids = []
|
||||
for item in data:
|
||||
model_ids.append((0, 0, {
|
||||
'name': item['name']
|
||||
}))
|
||||
self.cutting_tool_model = model_ids
|
||||
return {}
|
||||
except Exception as e:
|
||||
logging.info("获取刀具标准库失败")
|
||||
# @api.onchange('cutting_tool_material_id')
|
||||
# def _onchange_cutting_tool_material_id(self):
|
||||
# if self.cutting_tool_material_id:
|
||||
|
||||
|
||||
@api.depends('cutting_tool_material_id')
|
||||
def _get_cutting_tool_model(self):
|
||||
try:
|
||||
config = self.env['res.config.settings'].get_values()
|
||||
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
|
||||
url = config['sf_url'] + '/api/cutting_model/list'
|
||||
res = {'token': config['token'], 'cutting_tool_material_code': self.cutting_tool_material_id.code}
|
||||
result = requests.post(url, json=res, data=None, headers=headers)
|
||||
cutting_model_data = result.json()
|
||||
if result['state'] == 1:
|
||||
return {'cutting_model_data': cutting_model_data}
|
||||
except Exception as e:
|
||||
logging.info("获取刀具标准库失败")
|
||||
|
||||
@api.onchange('fixture_material_id')
|
||||
def _onchange_fixture_material_id(self):
|
||||
|
||||
@@ -8,3 +8,4 @@ access_sf_production_line,sf.production.line,model_sf_production_line,base.group
|
||||
access_maintenance_equipment_tool,maintenance_equipment_tool,model_maintenance_equipment_tool,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -32,7 +32,7 @@ class MrStaticResourceDataSync(models.Model):
|
||||
# logging.info("材料型号已每日同步成功")
|
||||
# self.env['mrs.international.standards']._cron_mrs_international_standards_func()
|
||||
# logging.info("材料型号材料应用已每日同步成功")
|
||||
# self.env['material.apply']._cron_material_apply_func()
|
||||
self.env['material.apply']._cron_material_apply_func()
|
||||
logging.info("材料型号材料应用已每日同步成功")
|
||||
self.env['sf.production.process.category'].sync_production_process_category_yesterday()
|
||||
logging.info("表面工艺类别已每日同步成功")
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
<field name="blade_hardness" string="加工硬度"/>
|
||||
<field name="blade_accuracy" string="精度等级"/>
|
||||
<field name="blade_coating_material_id" string="涂层材质"/>
|
||||
<field name="mrs_cutting_tool_model_blade_cutter_bar_ids" widget="many2many_tags"/>
|
||||
<!-- <field name="mrs_cutting_tool_model_blade_cutter_bar_ids" widget="many2many_tags"/>-->
|
||||
</group>
|
||||
<group>
|
||||
<field name="blade_top_angle" string="顶角(°)"/>
|
||||
|
||||
Reference in New Issue
Block a user