修复刀具产品模版

This commit is contained in:
jinling.yang
2024-03-14 11:54:10 +08:00
parent 5e0b4aa509
commit 86ec97bad1
7 changed files with 99 additions and 57 deletions

View File

@@ -8,8 +8,8 @@ from odoo.exceptions import ValidationError
from odoo.modules import get_resource_path
# from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file
class ResProductMo(models.Model):
@@ -70,7 +70,8 @@ class ResProductMo(models.Model):
cutting_tool_shank_length = fields.Float('柄部长度(mm)', digits=(6, 1))
cutting_tool_blade_length = fields.Float('刃部长度(mm)')
cutting_tool_blade_number = fields.Selection(
[('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8')], '刃数(个)')
[('0', '0'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8')],
string='刃数(个)', default='0')
# 整体式刀具新增字段
cutting_tool_neck_length = fields.Float('颈部长度(mm)', digits=(6, 1))
cutting_tool_neck_diameter = fields.Float('颈部直径(mm)', digits=(6, 1))
@@ -103,9 +104,9 @@ class ResProductMo(models.Model):
compaction_way_id = fields.Many2one('maintenance.equipment.image',
'压紧方式', domain=[('type', '=', '压紧方式')])
# @api.onchange('cutting_tool_model_id')
# def _onchange_cutting_tool_model_id(self):
# self.specification_id = False
@api.onchange('cutting_tool_model_id')
def _onchange_cutting_tool_model_id(self):
self.specification_id = False
@api.onchange('cutting_tool_material_id')
def _onchange_cutting_tool_material_id(self):
@@ -196,20 +197,24 @@ class ResProductMo(models.Model):
self.cutting_tool_blade_number = self.specification_id.blade_number
self.cutting_tool_blade_type = self.cutting_tool_model_id.blade_type
self.cutting_tool_shank_diameter = self.specification_id.handle_diameter
self.cutting_tool_shank_length = self.specification_id.handle_length
self.cutting_tool_neck_length = self.specification_id.neck_length
self.cutting_tool_neck_diameter = self.specification_id.neck_diameter
self.cutting_tool_blade_tip_diameter = self.specification_id.blade_tip_diameter
self.cutting_tool_blade_tip_taper = self.specification_id.blade_tip_taper
self.cutting_tool_blade_helix_angle = self.specification_id.blade_helix_angle
self.cutting_tool_blade_tip_working_size = self.specification_id.blade_tip_working_size
self.cutting_tool_pitch = self.specification_id.pitch
self.cutting_tool_blade_width = self.specification_id.blade_width
self.cutting_tool_blade_depth = self.specification_id.blade_depth
self.cutting_tool_cut_depth = self.specification_id.cutting_depth
self.cutting_tool_cut_depth_max = self.specification_id.cut_depth_max
self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids
self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
lambda r: int(r.blade_diameter) == int(self.specification_id.blade_diameter))
elif self.cutting_tool_type == '夹头':
self.cutting_tool_clamping_diameter_min = self.specification_id.min_clamping_diameter
self.cutting_tool_clamping_diameter_min = self.specification_id.max_clamping_diameter
self.cutting_tool_clamping_way = self.specification_id.clamping_mode
self.cutting_tool_clamping_diameter_max = self.specification_id.max_clamping_diameter
self.cutting_tool_taper = self.specification_id.taper
self.cutting_tool_top_diameter = self.specification_id.top_diameter
self.cutting_tool_outer_diameter = self.specification_id.outer_diameter
self.cutting_tool_inner_diameter = self.specification_id.inner_diameter
@@ -247,6 +252,7 @@ class ResProductMo(models.Model):
self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids
self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids
elif self.cutting_tool_type in ('刀盘', '刀杆'):
self.cutting_tool_blade_diameter = self.specification_id.blade_diameter
self.cutting_tool_total_length = self.specification_id.total_length
self.tool_length = self.specification_id.length
self.tool_thickness = self.specification_id.thickness
@@ -277,14 +283,19 @@ class ResProductMo(models.Model):
self.cutting_tool_cutter_head_diameter = self.specification_id.cutter_head_diameter
self.cutting_tool_interface_diameter = self.specification_id.interface_diameter
else:
self.cutting_tool_cutter_arbor_diameter = self.specification_id.cutter_arbor_diameter
self.cutting_tool_knife_head_height = self.specification_id.knife_head_height
self.cutting_tool_knife_head_width = self.specification_id.knife_head_width
self.cutting_tool_knife_head_length = self.specification_id.knife_head_length
self.cutting_tool_tool_shim = self.specification_id.tool_shim
self.cutting_tool_cotter_pin = self.specification_id.cotter_pin
self.cutting_tool_pressing_plate = self.specification_id.pressing_plate
self.cutting_tool_min_machining_aperture = self.specification_id.min_machining_aperture
self.cutting_tool_rear_angle = self.specification_id.relief_angle
elif self.cutting_tool_type == '刀柄':
self.cutting_tool_total_length = self.specification_id.total_length
self.cutting_tool_shank_diameter = self.specification_id.shank_diameter
self.cutting_tool_shank_length = self.specification_id.shank_length
self.cutting_tool_speed_max = self.specification_id.max_rotate_speed
self.cutting_tool_change_time = self.specification_id.tool_changing_time
self.cutting_tool_total_length = self.specification_id.total_length
@@ -301,6 +312,8 @@ class ResProductMo(models.Model):
self.cutting_tool_chuck_id = self.specification_id.chuck_id.id
self.cutting_tool_jump_accuracy = self.specification_id.diameter_slip_accuracy
self.cutting_tool_taper_shank_model = self.specification_id.taper_shank_model
self.cutting_tool_cooling_type = self.specification_id.cooling_model
self.cutting_tool_clamping_way = self.specification_id.clamping_mode
self.suitable_machining_method_ids = [(6, 0, [])] if not \
self.cutting_tool_model_id.suitable_machining_method_ids \
else [(6, 0, self.cutting_tool_model_id.suitable_machining_method_ids.ids)]